diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/CHANGELOG.md b/sdk/appcontainers/azure-mgmt-appcontainers/CHANGELOG.md index 134730ea829d..abe049d7d3ed 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/CHANGELOG.md +++ b/sdk/appcontainers/azure-mgmt-appcontainers/CHANGELOG.md @@ -1,5 +1,299 @@ # Release History +## 4.0.0b1 (2025-04-22) + +### Features Added + + - Client `ContainerAppsAPIClient` added operation group `app_resiliency` + - Client `ContainerAppsAPIClient` added operation group `builders` + - Client `ContainerAppsAPIClient` added operation group `builds_by_builder_resource` + - Client `ContainerAppsAPIClient` added operation group `builds` + - Client `ContainerAppsAPIClient` added operation group `build_auth_token` + - Client `ContainerAppsAPIClient` added operation group `container_apps_builds_by_container_app` + - Client `ContainerAppsAPIClient` added operation group `container_apps_builds` + - Client `ContainerAppsAPIClient` added operation group `container_apps_label_history` + - Client `ContainerAppsAPIClient` added operation group `container_apps_patches` + - Client `ContainerAppsAPIClient` added operation group `dot_net_components` + - Client `ContainerAppsAPIClient` added operation group `functions_extension` + - Client `ContainerAppsAPIClient` added operation group `logic_apps` + - Client `ContainerAppsAPIClient` added operation group `managed_environment_private_endpoint_connections` + - Client `ContainerAppsAPIClient` added operation group `managed_environment_private_link_resources` + - Client `ContainerAppsAPIClient` added operation group `dapr_component_resiliency_policies` + - Client `ContainerAppsAPIClient` added operation group `dapr_subscriptions` + - Client `ContainerAppsAPIClient` added operation group `http_route_config` + - Client `ContainerAppsAPIClient` added operation group `maintenance_configurations` + - Enum `ActiveRevisionsMode` added member `LABELS` + - Model `AzureFileProperties` added property `account_key_vault_properties` + - Model `BaseContainer` added property `image_type` + - Enum `BindingType` added member `AUTO` + - Model `BlobStorageTokenStore` added property `blob_container_uri` + - Model `BlobStorageTokenStore` added property `client_id` + - Model `BlobStorageTokenStore` added property `managed_identity_resource_id` + - Model `CertificateProperties` added property `deployment_errors` + - Model `CertificateProperties` added property `certificate_type` + - Enum `CertificateProvisioningState` added member `DELETING` + - Model `Configuration` added property `target_label` + - Model `Configuration` added property `revision_transition_threshold` + - Model `ConnectedEnvironmentStorageProperties` added property `provisioning_state` + - Model `ConnectedEnvironmentStorageProperties` added property `deployment_errors` + - Model `ConnectedEnvironmentStorageProperties` added property `smb` + - Model `Container` added property `image_type` + - Model `ContainerApp` added property `kind` + - Model `ContainerApp` added property `deployment_errors` + - Model `ContainerApp` added property `patching_configuration` + - Model `ContainerResources` added property `gpu` + - Model `Dapr` added property `app_health` + - Model `Dapr` added property `max_concurrency` + - Model `DaprComponent` added property `service_component_bind` + - Model `GithubActionConfiguration` added property `dockerfile_path` + - Model `GithubActionConfiguration` added property `build_environment_variables` + - Model `Ingress` added property `target_port_http_scheme` + - Model `InitContainer` added property `image_type` + - Enum `JavaComponentType` added member `NACOS` + - Enum `JavaComponentType` added member `SPRING_CLOUD_GATEWAY` + - Model `Job` added property `extended_location` + - Model `Job` added property `running_state` + - Model `JobExecution` added property `detailed_status` + - Model `JobPatchProperties` added property `extended_location` + - Model `LogAnalyticsConfiguration` added property `dynamic_json_columns` + - Model `ManagedEnvironment` added property `private_link_default_domain` + - Model `ManagedEnvironment` added property `app_insights_configuration` + - Model `ManagedEnvironment` added property `open_telemetry_configuration` + - Model `ManagedEnvironment` added property `availability_zones` + - Model `ManagedEnvironment` added property `ingress_configuration` + - Model `ManagedEnvironment` added property `private_endpoint_connections` + - Model `ManagedEnvironment` added property `public_network_access` + - Model `ReplicaContainer` added property `debug_endpoint` + - Model `Revision` added property `labels` + - Model `Runtime` added property `dotnet` + - Model `RuntimeJava` added property `java_agent` + - Model `ServiceBind` added property `client_type` + - Model `ServiceBind` added property `customized_keys` + - Model `SessionContainer` added property `probes` + - Enum `StorageType` added member `SMB` + - Model `WorkloadProfile` added property `enable_fips` + - Added model `AppInsightsConfiguration` + - Added model `AppResiliency` + - Added model `AppResiliencyCollection` + - Added model `BuildCollection` + - Added model `BuildConfiguration` + - Added enum `BuildProvisioningState` + - Added model `BuildResource` + - Added enum `BuildStatus` + - Added model `BuildToken` + - Added model `BuilderCollection` + - Added enum `BuilderProvisioningState` + - Added model `BuilderResource` + - Added model `BuilderResourceUpdate` + - Added enum `CertificateType` + - Added model `CircuitBreakerPolicy` + - Added model `ConnectedEnvironmentDaprComponent` + - Added model `ConnectedEnvironmentDaprComponentProperties` + - Added enum `ConnectedEnvironmentDaprComponentProvisioningState` + - Added model `ConnectedEnvironmentDaprComponentsCollection` + - Added model `ConnectedEnvironmentPatchResource` + - Added enum `ConnectedEnvironmentStorageProvisioningState` + - Added model `ContainerAppPropertiesPatchingConfiguration` + - Added model `ContainerAppsBuildCollection` + - Added model `ContainerAppsBuildConfiguration` + - Added model `ContainerAppsBuildResource` + - Added model `ContainerAppsPatchResource` + - Added model `ContainerExecutionStatus` + - Added model `ContainerRegistry` + - Added model `ContainerRegistryWithCustomImage` + - Added model `DaprAppHealth` + - Added model `DaprComponentProperties` + - Added model `DaprComponentResiliencyPoliciesCollection` + - Added model `DaprComponentResiliencyPolicy` + - Added model `DaprComponentResiliencyPolicyCircuitBreakerPolicyConfiguration` + - Added model `DaprComponentResiliencyPolicyConfiguration` + - Added model `DaprComponentResiliencyPolicyHttpRetryBackOffConfiguration` + - Added model `DaprComponentResiliencyPolicyHttpRetryPolicyConfiguration` + - Added model `DaprComponentResiliencyPolicyTimeoutPolicyConfiguration` + - Added model `DaprComponentServiceBinding` + - Added model `DaprServiceBindMetadata` + - Added model `DaprSubscription` + - Added model `DaprSubscriptionBulkSubscribeOptions` + - Added model `DaprSubscriptionRouteRule` + - Added model `DaprSubscriptionRoutes` + - Added model `DaprSubscriptionsCollection` + - Added model `DataDogConfiguration` + - Added model `DestinationsConfiguration` + - Added enum `DetectionStatus` + - Added model `DotNetComponent` + - Added model `DotNetComponentConfigurationProperty` + - Added enum `DotNetComponentProvisioningState` + - Added model `DotNetComponentServiceBind` + - Added enum `DotNetComponentType` + - Added model `DotNetComponentsCollection` + - Added model `EnvironmentVariable` + - Added model `ErrorEntity` + - Added model `ExecutionStatus` + - Added model `Header` + - Added model `HeaderMatch` + - Added model `HttpConnectionPool` + - Added model `HttpGet` + - Added model `HttpRetryPolicy` + - Added model `HttpRoute` + - Added model `HttpRouteAction` + - Added model `HttpRouteConfig` + - Added model `HttpRouteConfigCollection` + - Added model `HttpRouteConfigProperties` + - Added model `HttpRouteMatch` + - Added model `HttpRouteProvisioningErrors` + - Added enum `HttpRouteProvisioningState` + - Added model `HttpRouteRule` + - Added model `HttpRouteTarget` + - Added enum `ImageType` + - Added model `IngressConfiguration` + - Added model `IngressConfigurationScale` + - Added enum `IngressTargetPortHttpScheme` + - Added enum `JobRunningState` + - Added enum `Kind` + - Added model `LabelHistory` + - Added model `LabelHistoryCollection` + - Added model `LabelHistoryProperties` + - Added model `LabelHistoryRecordItem` + - Added enum `Level` + - Added model `LoggerSetting` + - Added model `LogicApp` + - Added enum `LogicAppsProxyMethod` + - Added model `LogsConfiguration` + - Added model `MaintenanceConfigurationCollection` + - Added model `MaintenanceConfigurationResource` + - Added model `MetricsConfiguration` + - Added model `NacosComponent` + - Added model `OpenTelemetryConfiguration` + - Added model `OtlpConfiguration` + - Added enum `PatchApplyStatus` + - Added model `PatchCollection` + - Added model `PatchDetails` + - Added model `PatchDetailsNewLayer` + - Added model `PatchDetailsOldLayer` + - Added model `PatchProperties` + - Added model `PatchSkipConfig` + - Added enum `PatchType` + - Added enum `PatchingMode` + - Added model `PreBuildStep` + - Added model `PrivateEndpoint` + - Added model `PrivateEndpointConnection` + - Added model `PrivateEndpointConnectionListResult` + - Added enum `PrivateEndpointConnectionProvisioningState` + - Added enum `PrivateEndpointServiceConnectionStatus` + - Added model `PrivateLinkResource` + - Added model `PrivateLinkResourceListResult` + - Added model `PrivateLinkServiceConnectionState` + - Added enum `PublicNetworkAccess` + - Added model `ReplicaExecutionStatus` + - Added model `ResourceTags` + - Added model `RuntimeDotnet` + - Added model `RuntimeJavaAgent` + - Added model `RuntimeJavaAgentLogging` + - Added model `ScgRoute` + - Added model `ScheduledEntry` + - Added model `SecretKeyVaultProperties` + - Added model `SessionProbe` + - Added model `SessionProbeHttpGet` + - Added model `SessionProbeHttpGetHttpHeadersItem` + - Added model `SessionProbeTcpSocket` + - Added enum `SessionProbeType` + - Added model `SmbStorage` + - Added model `SpringCloudGatewayComponent` + - Added enum `Status` + - Added model `TcpConnectionPool` + - Added model `TcpRetryPolicy` + - Added model `TimeoutPolicy` + - Added model `TracesConfiguration` + - Added enum `WeekDay` + - Added model `WorkflowArtifacts` + - Added model `WorkflowEnvelope` + - Added model `WorkflowEnvelopeCollection` + - Added model `WorkflowEnvelopeProperties` + - Added model `WorkflowHealth` + - Added enum `WorkflowHealthState` + - Added enum `WorkflowState` + - Model `ConnectedEnvironmentsCertificatesOperations` added method `begin_create_or_update` + - Model `ConnectedEnvironmentsCertificatesOperations` added method `begin_delete` + - Model `ConnectedEnvironmentsCertificatesOperations` added method `begin_update` + - Model `ConnectedEnvironmentsDaprComponentsOperations` added method `begin_create_or_update` + - Model `ConnectedEnvironmentsDaprComponentsOperations` added method `begin_delete` + - Model `ConnectedEnvironmentsStoragesOperations` added method `begin_create_or_update` + - Model `ConnectedEnvironmentsStoragesOperations` added method `begin_delete` + - Model `JobsOperations` added method `begin_resume` + - Model `JobsOperations` added method `begin_suspend` + - Added model `AppResiliencyOperations` + - Added model `BuildAuthTokenOperations` + - Added model `BuildersOperations` + - Added model `BuildsByBuilderResourceOperations` + - Added model `BuildsOperations` + - Added model `ContainerAppsBuildsByContainerAppOperations` + - Added model `ContainerAppsBuildsOperations` + - Added model `ContainerAppsLabelHistoryOperations` + - Added model `ContainerAppsPatchesOperations` + - Added model `DaprComponentResiliencyPoliciesOperations` + - Added model `DaprSubscriptionsOperations` + - Added model `DotNetComponentsOperations` + - Added model `FunctionsExtensionOperations` + - Added model `HttpRouteConfigOperations` + - Added model `LogicAppsOperations` + - Added model `MaintenanceConfigurationsOperations` + - Added model `ManagedEnvironmentPrivateEndpointConnectionsOperations` + - Added model `ManagedEnvironmentPrivateLinkResourcesOperations` + - Method `ConnectedEnvironmentsCertificatesOperations.begin_create_or_update` has a new overload `def begin_create_or_update(self: None, resource_group_name: str, connected_environment_name: str, certificate_name: str, certificate_envelope: Optional[Certificate], content_type: str)` + - Method `ConnectedEnvironmentsCertificatesOperations.begin_create_or_update` has a new overload `def begin_create_or_update(self: None, resource_group_name: str, connected_environment_name: str, certificate_name: str, certificate_envelope: Optional[IO[bytes]], content_type: str)` + - Method `ConnectedEnvironmentsCertificatesOperations.begin_update` has a new overload `def begin_update(self: None, resource_group_name: str, connected_environment_name: str, certificate_name: str, certificate_envelope: CertificatePatch, content_type: str)` + - Method `ConnectedEnvironmentsCertificatesOperations.begin_update` has a new overload `def begin_update(self: None, resource_group_name: str, connected_environment_name: str, certificate_name: str, certificate_envelope: IO[bytes], content_type: str)` + - Method `ConnectedEnvironmentsDaprComponentsOperations.begin_create_or_update` has a new overload `def begin_create_or_update(self: None, resource_group_name: str, connected_environment_name: str, component_name: str, dapr_component_envelope: ConnectedEnvironmentDaprComponent, content_type: str)` + - Method `ConnectedEnvironmentsDaprComponentsOperations.begin_create_or_update` has a new overload `def begin_create_or_update(self: None, resource_group_name: str, connected_environment_name: str, component_name: str, dapr_component_envelope: IO[bytes], content_type: str)` + - Method `ConnectedEnvironmentsOperations.update` has a new overload `def update(self: None, resource_group_name: str, connected_environment_name: str, environment_envelope: Optional[ConnectedEnvironmentPatchResource], content_type: str)` + - Method `ConnectedEnvironmentsOperations.update` has a new overload `def update(self: None, resource_group_name: str, connected_environment_name: str, environment_envelope: Optional[IO[bytes]], content_type: str)` + - Method `ConnectedEnvironmentsStoragesOperations.begin_create_or_update` has a new overload `def begin_create_or_update(self: None, resource_group_name: str, connected_environment_name: str, storage_name: str, storage_envelope: ConnectedEnvironmentStorage, content_type: str)` + - Method `ConnectedEnvironmentsStoragesOperations.begin_create_or_update` has a new overload `def begin_create_or_update(self: None, resource_group_name: str, connected_environment_name: str, storage_name: str, storage_envelope: IO[bytes], content_type: str)` + - Method `ContainerAppsSourceControlsOperations.begin_create_or_update` has a new overload `def begin_create_or_update(self: None, resource_group_name: str, container_app_name: str, source_control_name: str, source_control_envelope: SourceControl, x_ms_github_auxiliary: Optional[str], content_type: str)` + - Method `ContainerAppsSourceControlsOperations.begin_create_or_update` has a new overload `def begin_create_or_update(self: None, resource_group_name: str, container_app_name: str, source_control_name: str, source_control_envelope: IO[bytes], x_ms_github_auxiliary: Optional[str], content_type: str)` + - Method `AppResiliencyOperations.create_or_update` has a new overload `def create_or_update(self: None, resource_group_name: str, app_name: str, name: str, resiliency_envelope: AppResiliency, content_type: str)` + - Method `AppResiliencyOperations.create_or_update` has a new overload `def create_or_update(self: None, resource_group_name: str, app_name: str, name: str, resiliency_envelope: IO[bytes], content_type: str)` + - Method `AppResiliencyOperations.update` has a new overload `def update(self: None, resource_group_name: str, app_name: str, name: str, resiliency_envelope: AppResiliency, content_type: str)` + - Method `AppResiliencyOperations.update` has a new overload `def update(self: None, resource_group_name: str, app_name: str, name: str, resiliency_envelope: IO[bytes], content_type: str)` + - Method `BuildersOperations.begin_create_or_update` has a new overload `def begin_create_or_update(self: None, resource_group_name: str, builder_name: str, builder_envelope: BuilderResource, content_type: str)` + - Method `BuildersOperations.begin_create_or_update` has a new overload `def begin_create_or_update(self: None, resource_group_name: str, builder_name: str, builder_envelope: IO[bytes], content_type: str)` + - Method `BuildersOperations.begin_update` has a new overload `def begin_update(self: None, resource_group_name: str, builder_name: str, builder_envelope: BuilderResourceUpdate, content_type: str)` + - Method `BuildersOperations.begin_update` has a new overload `def begin_update(self: None, resource_group_name: str, builder_name: str, builder_envelope: IO[bytes], content_type: str)` + - Method `BuildsOperations.begin_create_or_update` has a new overload `def begin_create_or_update(self: None, resource_group_name: str, builder_name: str, build_name: str, build_envelope: BuildResource, content_type: str)` + - Method `BuildsOperations.begin_create_or_update` has a new overload `def begin_create_or_update(self: None, resource_group_name: str, builder_name: str, build_name: str, build_envelope: IO[bytes], content_type: str)` + - Method `ContainerAppsPatchesOperations.begin_skip_configure` has a new overload `def begin_skip_configure(self: None, resource_group_name: str, container_app_name: str, patch_name: str, patch_skip_config: PatchSkipConfig, content_type: str)` + - Method `ContainerAppsPatchesOperations.begin_skip_configure` has a new overload `def begin_skip_configure(self: None, resource_group_name: str, container_app_name: str, patch_name: str, patch_skip_config: IO[bytes], content_type: str)` + - Method `DaprComponentResiliencyPoliciesOperations.create_or_update` has a new overload `def create_or_update(self: None, resource_group_name: str, environment_name: str, component_name: str, name: str, dapr_component_resiliency_policy_envelope: DaprComponentResiliencyPolicy, content_type: str)` + - Method `DaprComponentResiliencyPoliciesOperations.create_or_update` has a new overload `def create_or_update(self: None, resource_group_name: str, environment_name: str, component_name: str, name: str, dapr_component_resiliency_policy_envelope: IO[bytes], content_type: str)` + - Method `DaprSubscriptionsOperations.create_or_update` has a new overload `def create_or_update(self: None, resource_group_name: str, environment_name: str, name: str, dapr_subscription_envelope: DaprSubscription, content_type: str)` + - Method `DaprSubscriptionsOperations.create_or_update` has a new overload `def create_or_update(self: None, resource_group_name: str, environment_name: str, name: str, dapr_subscription_envelope: IO[bytes], content_type: str)` + - Method `DotNetComponentsOperations.begin_create_or_update` has a new overload `def begin_create_or_update(self: None, resource_group_name: str, environment_name: str, name: str, dot_net_component_envelope: DotNetComponent, content_type: str)` + - Method `DotNetComponentsOperations.begin_create_or_update` has a new overload `def begin_create_or_update(self: None, resource_group_name: str, environment_name: str, name: str, dot_net_component_envelope: IO[bytes], content_type: str)` + - Method `DotNetComponentsOperations.begin_update` has a new overload `def begin_update(self: None, resource_group_name: str, environment_name: str, name: str, dot_net_component_envelope: DotNetComponent, content_type: str)` + - Method `DotNetComponentsOperations.begin_update` has a new overload `def begin_update(self: None, resource_group_name: str, environment_name: str, name: str, dot_net_component_envelope: IO[bytes], content_type: str)` + - Method `HttpRouteConfigOperations.create_or_update` has a new overload `def create_or_update(self: None, resource_group_name: str, environment_name: str, http_route_name: str, http_route_config_envelope: Optional[HttpRouteConfig], content_type: str)` + - Method `HttpRouteConfigOperations.create_or_update` has a new overload `def create_or_update(self: None, resource_group_name: str, environment_name: str, http_route_name: str, http_route_config_envelope: Optional[IO[bytes]], content_type: str)` + - Method `HttpRouteConfigOperations.update` has a new overload `def update(self: None, resource_group_name: str, environment_name: str, http_route_name: str, http_route_config_envelope: HttpRouteConfig, content_type: str)` + - Method `HttpRouteConfigOperations.update` has a new overload `def update(self: None, resource_group_name: str, environment_name: str, http_route_name: str, http_route_config_envelope: IO[bytes], content_type: str)` + - Method `LogicAppsOperations.create_or_update` has a new overload `def create_or_update(self: None, resource_group_name: str, container_app_name: str, logic_app_name: str, resource: LogicApp, content_type: str)` + - Method `LogicAppsOperations.create_or_update` has a new overload `def create_or_update(self: None, resource_group_name: str, container_app_name: str, logic_app_name: str, resource: IO[bytes], content_type: str)` + - Method `LogicAppsOperations.deploy_workflow_artifacts` has a new overload `def deploy_workflow_artifacts(self: None, resource_group_name: str, container_app_name: str, logic_app_name: str, workflow_artifacts: Optional[WorkflowArtifacts], content_type: str)` + - Method `LogicAppsOperations.deploy_workflow_artifacts` has a new overload `def deploy_workflow_artifacts(self: None, resource_group_name: str, container_app_name: str, logic_app_name: str, workflow_artifacts: Optional[IO[bytes]], content_type: str)` + - Method `MaintenanceConfigurationsOperations.create_or_update` has a new overload `def create_or_update(self: None, resource_group_name: str, environment_name: str, config_name: str, maintenance_configuration_envelope: MaintenanceConfigurationResource, content_type: str)` + - Method `MaintenanceConfigurationsOperations.create_or_update` has a new overload `def create_or_update(self: None, resource_group_name: str, environment_name: str, config_name: str, maintenance_configuration_envelope: IO[bytes], content_type: str)` + - Method `ManagedEnvironmentPrivateEndpointConnectionsOperations.begin_create_or_update` has a new overload `def begin_create_or_update(self: None, resource_group_name: str, environment_name: str, private_endpoint_connection_name: str, private_endpoint_connection_envelope: PrivateEndpointConnection, content_type: str)` + - Method `ManagedEnvironmentPrivateEndpointConnectionsOperations.begin_create_or_update` has a new overload `def begin_create_or_update(self: None, resource_group_name: str, environment_name: str, private_endpoint_connection_name: str, private_endpoint_connection_envelope: IO[bytes], content_type: str)` + +### Breaking Changes + + - Deleted or renamed method `ConnectedEnvironmentsCertificatesOperations.create_or_update` + - Deleted or renamed method `ConnectedEnvironmentsCertificatesOperations.delete` + - Deleted or renamed method `ConnectedEnvironmentsCertificatesOperations.update` + - Deleted or renamed method `ConnectedEnvironmentsDaprComponentsOperations.create_or_update` + - Deleted or renamed method `ConnectedEnvironmentsDaprComponentsOperations.delete` + - Deleted or renamed method `ConnectedEnvironmentsStoragesOperations.create_or_update` + - Deleted or renamed method `ConnectedEnvironmentsStoragesOperations.delete` + ## 3.2.0 (2025-04-20) ### Features Added diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/README.md b/sdk/appcontainers/azure-mgmt-appcontainers/README.md index 8a8a94e98a53..7cef05198e74 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/README.md +++ b/sdk/appcontainers/azure-mgmt-appcontainers/README.md @@ -1,7 +1,7 @@ # Microsoft Azure SDK for Python This is the Microsoft Azure Appcontainers Management Client Library. -This package has been tested with Python 3.8+. +This package has been tested with Python 3.9+. For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all). ## _Disclaimer_ @@ -12,7 +12,7 @@ _Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For ### Prerequisites -- Python 3.8+ is required to use this package. +- Python 3.9+ is required to use this package. - [Azure subscription](https://azure.microsoft.com/free/) ### Install the package diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/_meta.json b/sdk/appcontainers/azure-mgmt-appcontainers/_meta.json index 04982de3727c..27a88b661fd2 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/_meta.json +++ b/sdk/appcontainers/azure-mgmt-appcontainers/_meta.json @@ -1,11 +1,11 @@ { - "commit": "0c62abad8eabfcba5c50a0dfdc5778d86bab2130", + "commit": "fb801f91a8d8a7568e93bdac511534fbbfe8af72", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.10.2", "use": [ - "@autorest/python@6.27.4", + "@autorest/python@6.33.0", "@autorest/modelerfour@4.27.0" ], - "autorest_command": "autorest specification/app/resource-manager/readme.md --generate-sample=True --generate-test=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.27.4 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", + "autorest_command": "autorest specification/app/resource-manager/readme.md --generate-sample=True --generate-test=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.33.0 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", "readme": "specification/app/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_configuration.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_configuration.py index e61c302fbdf2..9dfadbf55077 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_configuration.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_configuration.py @@ -25,15 +25,15 @@ class ContainerAppsAPIClientConfiguration: # pylint: disable=too-many-instance- :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The ID of the target subscription. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2025-01-01". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2025-02-02-preview". Note that overriding + this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2025-01-01") + api_version: str = kwargs.pop("api_version", "2025-02-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 3833018cbbe8..2ec8b5bb346b 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 @@ -7,20 +7,27 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from . import models as _models from ._configuration import ContainerAppsAPIClientConfiguration from ._serialization import Deserializer, Serializer from .operations import ( + AppResiliencyOperations, AvailableWorkloadProfilesOperations, BillingMetersOperations, + BuildAuthTokenOperations, + BuildersOperations, + BuildsByBuilderResourceOperations, + BuildsOperations, CertificatesOperations, ConnectedEnvironmentsCertificatesOperations, ConnectedEnvironmentsDaprComponentsOperations, @@ -28,18 +35,31 @@ ConnectedEnvironmentsStoragesOperations, ContainerAppsAPIClientOperationsMixin, ContainerAppsAuthConfigsOperations, + ContainerAppsBuildsByContainerAppOperations, + ContainerAppsBuildsOperations, ContainerAppsDiagnosticsOperations, + ContainerAppsLabelHistoryOperations, ContainerAppsOperations, + ContainerAppsPatchesOperations, ContainerAppsRevisionReplicasOperations, ContainerAppsRevisionsOperations, ContainerAppsSessionPoolsOperations, ContainerAppsSourceControlsOperations, + DaprComponentResiliencyPoliciesOperations, DaprComponentsOperations, + DaprSubscriptionsOperations, + DotNetComponentsOperations, + FunctionsExtensionOperations, + HttpRouteConfigOperations, JavaComponentsOperations, JobsExecutionsOperations, JobsOperations, + LogicAppsOperations, + MaintenanceConfigurationsOperations, ManagedCertificatesOperations, ManagedEnvironmentDiagnosticsOperations, + ManagedEnvironmentPrivateEndpointConnectionsOperations, + ManagedEnvironmentPrivateLinkResourcesOperations, ManagedEnvironmentUsagesOperations, ManagedEnvironmentsDiagnosticsOperations, ManagedEnvironmentsOperations, @@ -54,8 +74,12 @@ class ContainerAppsAPIClient(ContainerAppsAPIClientOperationsMixin): # pylint: disable=too-many-instance-attributes - """ContainerAppsAPIClient. + """Functions is an extension resource to revisions and the api listed is used to proxy the call + from Web RP to the function app's host process, this api is not exposed to users and only Web + RP is allowed to invoke functions extension resource. + :ivar app_resiliency: AppResiliencyOperations operations + :vartype app_resiliency: azure.mgmt.appcontainers.operations.AppResiliencyOperations :ivar container_apps_auth_configs: ContainerAppsAuthConfigsOperations operations :vartype container_apps_auth_configs: azure.mgmt.appcontainers.operations.ContainerAppsAuthConfigsOperations @@ -64,6 +88,15 @@ class ContainerAppsAPIClient(ContainerAppsAPIClientOperationsMixin): # pylint: azure.mgmt.appcontainers.operations.AvailableWorkloadProfilesOperations :ivar billing_meters: BillingMetersOperations operations :vartype billing_meters: azure.mgmt.appcontainers.operations.BillingMetersOperations + :ivar builders: BuildersOperations operations + :vartype builders: azure.mgmt.appcontainers.operations.BuildersOperations + :ivar builds_by_builder_resource: BuildsByBuilderResourceOperations operations + :vartype builds_by_builder_resource: + azure.mgmt.appcontainers.operations.BuildsByBuilderResourceOperations + :ivar builds: BuildsOperations operations + :vartype builds: azure.mgmt.appcontainers.operations.BuildsOperations + :ivar build_auth_token: BuildAuthTokenOperations operations + :vartype build_auth_token: azure.mgmt.appcontainers.operations.BuildAuthTokenOperations :ivar connected_environments: ConnectedEnvironmentsOperations operations :vartype connected_environments: azure.mgmt.appcontainers.operations.ConnectedEnvironmentsOperations @@ -80,6 +113,19 @@ class ContainerAppsAPIClient(ContainerAppsAPIClientOperationsMixin): # pylint: azure.mgmt.appcontainers.operations.ConnectedEnvironmentsStoragesOperations :ivar container_apps: ContainerAppsOperations operations :vartype container_apps: azure.mgmt.appcontainers.operations.ContainerAppsOperations + :ivar container_apps_builds_by_container_app: ContainerAppsBuildsByContainerAppOperations + operations + :vartype container_apps_builds_by_container_app: + azure.mgmt.appcontainers.operations.ContainerAppsBuildsByContainerAppOperations + :ivar container_apps_builds: ContainerAppsBuildsOperations operations + :vartype container_apps_builds: + azure.mgmt.appcontainers.operations.ContainerAppsBuildsOperations + :ivar container_apps_label_history: ContainerAppsLabelHistoryOperations operations + :vartype container_apps_label_history: + azure.mgmt.appcontainers.operations.ContainerAppsLabelHistoryOperations + :ivar container_apps_patches: ContainerAppsPatchesOperations operations + :vartype container_apps_patches: + azure.mgmt.appcontainers.operations.ContainerAppsPatchesOperations :ivar container_apps_revisions: ContainerAppsRevisionsOperations operations :vartype container_apps_revisions: azure.mgmt.appcontainers.operations.ContainerAppsRevisionsOperations @@ -97,12 +143,18 @@ class ContainerAppsAPIClient(ContainerAppsAPIClientOperationsMixin): # pylint: azure.mgmt.appcontainers.operations.ManagedEnvironmentsDiagnosticsOperations :ivar jobs: JobsOperations operations :vartype jobs: azure.mgmt.appcontainers.operations.JobsOperations + :ivar dot_net_components: DotNetComponentsOperations operations + :vartype dot_net_components: azure.mgmt.appcontainers.operations.DotNetComponentsOperations + :ivar functions_extension: FunctionsExtensionOperations operations + :vartype functions_extension: azure.mgmt.appcontainers.operations.FunctionsExtensionOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.appcontainers.operations.Operations :ivar java_components: JavaComponentsOperations operations :vartype java_components: azure.mgmt.appcontainers.operations.JavaComponentsOperations :ivar jobs_executions: JobsExecutionsOperations operations :vartype jobs_executions: azure.mgmt.appcontainers.operations.JobsExecutionsOperations + :ivar logic_apps: LogicAppsOperations operations + :vartype logic_apps: azure.mgmt.appcontainers.operations.LogicAppsOperations :ivar managed_environments: ManagedEnvironmentsOperations operations :vartype managed_environments: azure.mgmt.appcontainers.operations.ManagedEnvironmentsOperations @@ -113,8 +165,26 @@ class ContainerAppsAPIClient(ContainerAppsAPIClientOperationsMixin): # pylint: azure.mgmt.appcontainers.operations.ManagedCertificatesOperations :ivar namespaces: NamespacesOperations operations :vartype namespaces: azure.mgmt.appcontainers.operations.NamespacesOperations + :ivar managed_environment_private_endpoint_connections: + ManagedEnvironmentPrivateEndpointConnectionsOperations operations + :vartype managed_environment_private_endpoint_connections: + azure.mgmt.appcontainers.operations.ManagedEnvironmentPrivateEndpointConnectionsOperations + :ivar managed_environment_private_link_resources: + ManagedEnvironmentPrivateLinkResourcesOperations operations + :vartype managed_environment_private_link_resources: + azure.mgmt.appcontainers.operations.ManagedEnvironmentPrivateLinkResourcesOperations + :ivar dapr_component_resiliency_policies: DaprComponentResiliencyPoliciesOperations operations + :vartype dapr_component_resiliency_policies: + azure.mgmt.appcontainers.operations.DaprComponentResiliencyPoliciesOperations :ivar dapr_components: DaprComponentsOperations operations :vartype dapr_components: azure.mgmt.appcontainers.operations.DaprComponentsOperations + :ivar dapr_subscriptions: DaprSubscriptionsOperations operations + :vartype dapr_subscriptions: azure.mgmt.appcontainers.operations.DaprSubscriptionsOperations + :ivar http_route_config: HttpRouteConfigOperations operations + :vartype http_route_config: azure.mgmt.appcontainers.operations.HttpRouteConfigOperations + :ivar maintenance_configurations: MaintenanceConfigurationsOperations operations + :vartype maintenance_configurations: + azure.mgmt.appcontainers.operations.MaintenanceConfigurationsOperations :ivar managed_environments_storages: ManagedEnvironmentsStoragesOperations operations :vartype managed_environments_storages: azure.mgmt.appcontainers.operations.ManagedEnvironmentsStoragesOperations @@ -131,27 +201,29 @@ class ContainerAppsAPIClient(ContainerAppsAPIClientOperationsMixin): # pylint: azure.mgmt.appcontainers.operations.ManagedEnvironmentUsagesOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The ID of the target subscription. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str - :keyword api_version: Api Version. Default value is "2025-01-01". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2025-02-02-preview". Note that overriding + this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = ContainerAppsAPIClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -170,12 +242,13 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False + self.app_resiliency = AppResiliencyOperations(self._client, self._config, self._serialize, self._deserialize) self.container_apps_auth_configs = ContainerAppsAuthConfigsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -183,6 +256,12 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.billing_meters = BillingMetersOperations(self._client, self._config, self._serialize, self._deserialize) + self.builders = BuildersOperations(self._client, self._config, self._serialize, self._deserialize) + self.builds_by_builder_resource = BuildsByBuilderResourceOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.builds = BuildsOperations(self._client, self._config, self._serialize, self._deserialize) + self.build_auth_token = BuildAuthTokenOperations(self._client, self._config, self._serialize, self._deserialize) self.connected_environments = ConnectedEnvironmentsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -196,6 +275,18 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.container_apps = ContainerAppsOperations(self._client, self._config, self._serialize, self._deserialize) + self.container_apps_builds_by_container_app = ContainerAppsBuildsByContainerAppOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.container_apps_builds = ContainerAppsBuildsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.container_apps_label_history = ContainerAppsLabelHistoryOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.container_apps_patches = ContainerAppsPatchesOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.container_apps_revisions = ContainerAppsRevisionsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -212,9 +303,16 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) + self.dot_net_components = DotNetComponentsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.functions_extension = FunctionsExtensionOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.java_components = JavaComponentsOperations(self._client, self._config, self._serialize, self._deserialize) self.jobs_executions = JobsExecutionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.logic_apps = LogicAppsOperations(self._client, self._config, self._serialize, self._deserialize) self.managed_environments = ManagedEnvironmentsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -223,7 +321,25 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.namespaces = NamespacesOperations(self._client, self._config, self._serialize, self._deserialize) + self.managed_environment_private_endpoint_connections = ManagedEnvironmentPrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_environment_private_link_resources = ManagedEnvironmentPrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.dapr_component_resiliency_policies = DaprComponentResiliencyPoliciesOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.dapr_components = DaprComponentsOperations(self._client, self._config, self._serialize, self._deserialize) + self.dapr_subscriptions = DaprSubscriptionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.http_route_config = HttpRouteConfigOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.maintenance_configurations = MaintenanceConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.managed_environments_storages = ManagedEnvironmentsStoragesOperations( self._client, self._config, self._serialize, self._deserialize ) diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_serialization.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_serialization.py index b24ab2885450..f5187701d7be 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_serialization.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_serialization.py @@ -1,28 +1,10 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines +# coding=utf-8 # -------------------------------------------------------------------------- -# # Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- # pyright: reportUnnecessaryTypeIgnoreComment=false @@ -48,9 +30,7 @@ IO, Mapping, Callable, - TypeVar, MutableMapping, - Type, List, ) @@ -61,13 +41,13 @@ import xml.etree.ElementTree as ET import isodate # type: ignore +from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") -ModelType = TypeVar("ModelType", bound="Model") JSON = MutableMapping[str, Any] @@ -185,73 +165,7 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], except NameError: _long_type = int - -class UTC(datetime.tzinfo): - """Time Zone info for handling UTC""" - - def utcoffset(self, dt): - """UTF offset for UTC is 0. - - :param datetime.datetime dt: The datetime - :returns: The offset - :rtype: datetime.timedelta - """ - return datetime.timedelta(0) - - def tzname(self, dt): - """Timestamp representation. - - :param datetime.datetime dt: The datetime - :returns: The timestamp representation - :rtype: str - """ - return "Z" - - def dst(self, dt): - """No daylight saving for UTC. - - :param datetime.datetime dt: The datetime - :returns: The daylight saving time - :rtype: datetime.timedelta - """ - return datetime.timedelta(hours=1) - - -try: - from datetime import timezone as _FixedOffset # type: ignore -except ImportError: # Python 2.7 - - class _FixedOffset(datetime.tzinfo): # type: ignore - """Fixed offset in minutes east from UTC. - Copy/pasted from Python doc - :param datetime.timedelta offset: offset in timedelta format - """ - - def __init__(self, offset) -> None: - self.__offset = offset - - def utcoffset(self, dt): - return self.__offset - - def tzname(self, dt): - return str(self.__offset.total_seconds() / 3600) - - def __repr__(self): - return "".format(self.tzname(None)) - - def dst(self, dt): - return datetime.timedelta(0) - - def __getinitargs__(self): - return (self.__offset,) - - -try: - from datetime import timezone - - TZ_UTC = timezone.utc -except ImportError: - TZ_UTC = UTC() # type: ignore +TZ_UTC = datetime.timezone.utc _FLATTEN = re.compile(r"(? ModelType: + def deserialize(cls, data: Any, content_type: Optional[str] = None) -> Self: """Parse a str using the RestAPI syntax and return a model. :param str data: A str using RestAPI structure. JSON by default. :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model - :raises: DeserializationError if something went wrong - :rtype: ModelType + :raises DeserializationError: if something went wrong + :rtype: Self """ deserializer = Deserializer(cls._infer_class_models()) return deserializer(cls.__name__, data, content_type=content_type) # type: ignore @classmethod def from_dict( - cls: Type[ModelType], + cls, data: Any, key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, content_type: Optional[str] = None, - ) -> ModelType: + ) -> Self: """Parse a dict using given key extractor return a model. By default consider key @@ -479,8 +393,8 @@ def from_dict( :param function key_extractors: A key extractor function. :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model - :raises: DeserializationError if something went wrong - :rtype: ModelType + :raises DeserializationError: if something went wrong + :rtype: Self """ deserializer = Deserializer(cls._infer_class_models()) deserializer.key_extractors = ( # type: ignore @@ -626,7 +540,7 @@ def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, to :param object target_obj: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str, dict - :raises: SerializationError if serialization fails. + :raises SerializationError: if serialization fails. :returns: The serialized data. """ key_transformer = kwargs.get("key_transformer", self.key_transformer) @@ -736,8 +650,8 @@ def body(self, data, data_type, **kwargs): :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: dict - :raises: SerializationError if serialization fails. - :raises: ValueError if data is None + :raises SerializationError: if serialization fails. + :raises ValueError: if data is None :returns: The serialized request body """ @@ -781,8 +695,8 @@ def url(self, name, data, data_type, **kwargs): :param str data_type: The type to be serialized from. :rtype: str :returns: The serialized URL path - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :raises TypeError: if serialization fails. + :raises ValueError: if data is None """ try: output = self.serialize_data(data, data_type, **kwargs) @@ -805,8 +719,8 @@ def query(self, name, data, data_type, **kwargs): :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str, list - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :raises TypeError: if serialization fails. + :raises ValueError: if data is None :returns: The serialized query parameter """ try: @@ -835,8 +749,8 @@ def header(self, name, data, data_type, **kwargs): :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :raises TypeError: if serialization fails. + :raises ValueError: if data is None :returns: The serialized header """ try: @@ -855,9 +769,9 @@ def serialize_data(self, data, data_type, **kwargs): :param object data: The data to be serialized. :param str data_type: The type to be serialized from. - :raises: AttributeError if required data is None. - :raises: ValueError if data is None - :raises: SerializationError if serialization fails. + :raises AttributeError: if required data is None. + :raises ValueError: if data is None + :raises SerializationError: if serialization fails. :returns: The serialized data. :rtype: str, int, float, bool, dict, list """ @@ -1192,7 +1106,7 @@ def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument :param Datetime attr: Object to be serialized. :rtype: str - :raises: TypeError if format invalid. + :raises TypeError: if format invalid. :return: serialized rfc """ try: @@ -1218,7 +1132,7 @@ def serialize_iso(attr, **kwargs): # pylint: disable=unused-argument :param Datetime attr: Object to be serialized. :rtype: str - :raises: SerializationError if format invalid. + :raises SerializationError: if format invalid. :return: serialized iso """ if isinstance(attr, str): @@ -1251,7 +1165,7 @@ def serialize_unix(attr, **kwargs): # pylint: disable=unused-argument :param Datetime attr: Object to be serialized. :rtype: int - :raises: SerializationError if format invalid + :raises SerializationError: if format invalid :return: serialied unix """ if isinstance(attr, int): @@ -1429,7 +1343,7 @@ def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument # Iter and wrapped, should have found one node only (the wrap one) if len(children) != 1: raise DeserializationError( - "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( # pylint: disable=line-too-long + "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( xml_name ) ) @@ -1488,7 +1402,7 @@ def __call__(self, target_obj, response_data, content_type=None): :param str target_obj: Target data type to deserialize to. :param requests.Response response_data: REST response object. :param str content_type: Swagger "produces" if available. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. :rtype: object """ @@ -1502,7 +1416,7 @@ def _deserialize(self, target_obj, data): # pylint: disable=inconsistent-return :param str target_obj: Target data type to deserialize to. :param object data: Object to deserialize. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. :rtype: object """ @@ -1717,7 +1631,7 @@ def deserialize_data(self, data, data_type): # pylint: disable=too-many-return- :param str data: The response string to be deserialized. :param str data_type: The type to deserialize to. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. :rtype: object """ @@ -1799,7 +1713,7 @@ def deserialize_object(self, attr, **kwargs): # pylint: disable=too-many-return :param dict attr: Dictionary to be deserialized. :return: Deserialized object. :rtype: dict - :raises: TypeError if non-builtin datatype encountered. + :raises TypeError: if non-builtin datatype encountered. """ if attr is None: return None @@ -1845,7 +1759,7 @@ def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return :param str data_type: deserialization data type. :return: Deserialized basic type. :rtype: str, int, float or bool - :raises: TypeError if string format is not valid. + :raises TypeError: if string format is not valid. """ # If we're here, data is supposed to be a basic type. # If it's still an XML node, take the text @@ -1936,7 +1850,7 @@ def deserialize_bytearray(attr): :param str attr: response string to be deserialized. :return: Deserialized bytearray :rtype: bytearray - :raises: TypeError if string format invalid. + :raises TypeError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1949,7 +1863,7 @@ def deserialize_base64(attr): :param str attr: response string to be deserialized. :return: Deserialized base64 string :rtype: bytearray - :raises: TypeError if string format invalid. + :raises TypeError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1964,7 +1878,7 @@ def deserialize_decimal(attr): :param str attr: response string to be deserialized. :return: Deserialized decimal - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. :rtype: decimal """ if isinstance(attr, ET.Element): @@ -1982,7 +1896,7 @@ def deserialize_long(attr): :param str attr: response string to be deserialized. :return: Deserialized int :rtype: long or int - :raises: ValueError if string format invalid. + :raises ValueError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1995,7 +1909,7 @@ def deserialize_duration(attr): :param str attr: response string to be deserialized. :return: Deserialized duration :rtype: TimeDelta - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -2013,7 +1927,7 @@ def deserialize_date(attr): :param str attr: response string to be deserialized. :return: Deserialized date :rtype: Date - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -2029,7 +1943,7 @@ def deserialize_time(attr): :param str attr: response string to be deserialized. :return: Deserialized time :rtype: datetime.time - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -2044,14 +1958,14 @@ def deserialize_rfc(attr): :param str attr: response string to be deserialized. :return: Deserialized RFC datetime :rtype: Datetime - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text try: parsed_date = email.utils.parsedate_tz(attr) # type: ignore date_obj = datetime.datetime( - *parsed_date[:6], tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) + *parsed_date[:6], tzinfo=datetime.timezone(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) ) if not date_obj.tzinfo: date_obj = date_obj.astimezone(tz=TZ_UTC) @@ -2067,7 +1981,7 @@ def deserialize_iso(attr): :param str attr: response string to be deserialized. :return: Deserialized ISO datetime :rtype: Datetime - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -2105,7 +2019,7 @@ def deserialize_unix(attr): :param int attr: Object to be serialized. :return: Deserialized datetime :rtype: Datetime - :raises: DeserializationError if format invalid + :raises DeserializationError: if format invalid """ if isinstance(attr, ET.Element): attr = int(attr.text) # type: ignore 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 509b38085125..3073d7c910a0 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.2.0" +VERSION = "4.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 6d22c9c3efd3..47f5edc35d1e 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 @@ -25,15 +25,15 @@ class ContainerAppsAPIClientConfiguration: # pylint: disable=too-many-instance- :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The ID of the target subscription. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2025-01-01". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2025-02-02-preview". Note that overriding + this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2025-01-01") + api_version: str = kwargs.pop("api_version", "2025-02-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 20b825b6f278..b529c8a13d8e 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 @@ -7,20 +7,27 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING +from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from .. import models as _models from .._serialization import Deserializer, Serializer from ._configuration import ContainerAppsAPIClientConfiguration from .operations import ( + AppResiliencyOperations, AvailableWorkloadProfilesOperations, BillingMetersOperations, + BuildAuthTokenOperations, + BuildersOperations, + BuildsByBuilderResourceOperations, + BuildsOperations, CertificatesOperations, ConnectedEnvironmentsCertificatesOperations, ConnectedEnvironmentsDaprComponentsOperations, @@ -28,18 +35,31 @@ ConnectedEnvironmentsStoragesOperations, ContainerAppsAPIClientOperationsMixin, ContainerAppsAuthConfigsOperations, + ContainerAppsBuildsByContainerAppOperations, + ContainerAppsBuildsOperations, ContainerAppsDiagnosticsOperations, + ContainerAppsLabelHistoryOperations, ContainerAppsOperations, + ContainerAppsPatchesOperations, ContainerAppsRevisionReplicasOperations, ContainerAppsRevisionsOperations, ContainerAppsSessionPoolsOperations, ContainerAppsSourceControlsOperations, + DaprComponentResiliencyPoliciesOperations, DaprComponentsOperations, + DaprSubscriptionsOperations, + DotNetComponentsOperations, + FunctionsExtensionOperations, + HttpRouteConfigOperations, JavaComponentsOperations, JobsExecutionsOperations, JobsOperations, + LogicAppsOperations, + MaintenanceConfigurationsOperations, ManagedCertificatesOperations, ManagedEnvironmentDiagnosticsOperations, + ManagedEnvironmentPrivateEndpointConnectionsOperations, + ManagedEnvironmentPrivateLinkResourcesOperations, ManagedEnvironmentUsagesOperations, ManagedEnvironmentsDiagnosticsOperations, ManagedEnvironmentsOperations, @@ -54,8 +74,12 @@ class ContainerAppsAPIClient(ContainerAppsAPIClientOperationsMixin): # pylint: disable=too-many-instance-attributes - """ContainerAppsAPIClient. + """Functions is an extension resource to revisions and the api listed is used to proxy the call + from Web RP to the function app's host process, this api is not exposed to users and only Web + RP is allowed to invoke functions extension resource. + :ivar app_resiliency: AppResiliencyOperations operations + :vartype app_resiliency: azure.mgmt.appcontainers.aio.operations.AppResiliencyOperations :ivar container_apps_auth_configs: ContainerAppsAuthConfigsOperations operations :vartype container_apps_auth_configs: azure.mgmt.appcontainers.aio.operations.ContainerAppsAuthConfigsOperations @@ -64,6 +88,15 @@ class ContainerAppsAPIClient(ContainerAppsAPIClientOperationsMixin): # pylint: azure.mgmt.appcontainers.aio.operations.AvailableWorkloadProfilesOperations :ivar billing_meters: BillingMetersOperations operations :vartype billing_meters: azure.mgmt.appcontainers.aio.operations.BillingMetersOperations + :ivar builders: BuildersOperations operations + :vartype builders: azure.mgmt.appcontainers.aio.operations.BuildersOperations + :ivar builds_by_builder_resource: BuildsByBuilderResourceOperations operations + :vartype builds_by_builder_resource: + azure.mgmt.appcontainers.aio.operations.BuildsByBuilderResourceOperations + :ivar builds: BuildsOperations operations + :vartype builds: azure.mgmt.appcontainers.aio.operations.BuildsOperations + :ivar build_auth_token: BuildAuthTokenOperations operations + :vartype build_auth_token: azure.mgmt.appcontainers.aio.operations.BuildAuthTokenOperations :ivar connected_environments: ConnectedEnvironmentsOperations operations :vartype connected_environments: azure.mgmt.appcontainers.aio.operations.ConnectedEnvironmentsOperations @@ -80,6 +113,19 @@ class ContainerAppsAPIClient(ContainerAppsAPIClientOperationsMixin): # pylint: azure.mgmt.appcontainers.aio.operations.ConnectedEnvironmentsStoragesOperations :ivar container_apps: ContainerAppsOperations operations :vartype container_apps: azure.mgmt.appcontainers.aio.operations.ContainerAppsOperations + :ivar container_apps_builds_by_container_app: ContainerAppsBuildsByContainerAppOperations + operations + :vartype container_apps_builds_by_container_app: + azure.mgmt.appcontainers.aio.operations.ContainerAppsBuildsByContainerAppOperations + :ivar container_apps_builds: ContainerAppsBuildsOperations operations + :vartype container_apps_builds: + azure.mgmt.appcontainers.aio.operations.ContainerAppsBuildsOperations + :ivar container_apps_label_history: ContainerAppsLabelHistoryOperations operations + :vartype container_apps_label_history: + azure.mgmt.appcontainers.aio.operations.ContainerAppsLabelHistoryOperations + :ivar container_apps_patches: ContainerAppsPatchesOperations operations + :vartype container_apps_patches: + azure.mgmt.appcontainers.aio.operations.ContainerAppsPatchesOperations :ivar container_apps_revisions: ContainerAppsRevisionsOperations operations :vartype container_apps_revisions: azure.mgmt.appcontainers.aio.operations.ContainerAppsRevisionsOperations @@ -97,12 +143,19 @@ class ContainerAppsAPIClient(ContainerAppsAPIClientOperationsMixin): # pylint: azure.mgmt.appcontainers.aio.operations.ManagedEnvironmentsDiagnosticsOperations :ivar jobs: JobsOperations operations :vartype jobs: azure.mgmt.appcontainers.aio.operations.JobsOperations + :ivar dot_net_components: DotNetComponentsOperations operations + :vartype dot_net_components: azure.mgmt.appcontainers.aio.operations.DotNetComponentsOperations + :ivar functions_extension: FunctionsExtensionOperations operations + :vartype functions_extension: + azure.mgmt.appcontainers.aio.operations.FunctionsExtensionOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.appcontainers.aio.operations.Operations :ivar java_components: JavaComponentsOperations operations :vartype java_components: azure.mgmt.appcontainers.aio.operations.JavaComponentsOperations :ivar jobs_executions: JobsExecutionsOperations operations :vartype jobs_executions: azure.mgmt.appcontainers.aio.operations.JobsExecutionsOperations + :ivar logic_apps: LogicAppsOperations operations + :vartype logic_apps: azure.mgmt.appcontainers.aio.operations.LogicAppsOperations :ivar managed_environments: ManagedEnvironmentsOperations operations :vartype managed_environments: azure.mgmt.appcontainers.aio.operations.ManagedEnvironmentsOperations @@ -113,8 +166,27 @@ class ContainerAppsAPIClient(ContainerAppsAPIClientOperationsMixin): # pylint: azure.mgmt.appcontainers.aio.operations.ManagedCertificatesOperations :ivar namespaces: NamespacesOperations operations :vartype namespaces: azure.mgmt.appcontainers.aio.operations.NamespacesOperations + :ivar managed_environment_private_endpoint_connections: + ManagedEnvironmentPrivateEndpointConnectionsOperations operations + :vartype managed_environment_private_endpoint_connections: + azure.mgmt.appcontainers.aio.operations.ManagedEnvironmentPrivateEndpointConnectionsOperations + :ivar managed_environment_private_link_resources: + ManagedEnvironmentPrivateLinkResourcesOperations operations + :vartype managed_environment_private_link_resources: + azure.mgmt.appcontainers.aio.operations.ManagedEnvironmentPrivateLinkResourcesOperations + :ivar dapr_component_resiliency_policies: DaprComponentResiliencyPoliciesOperations operations + :vartype dapr_component_resiliency_policies: + azure.mgmt.appcontainers.aio.operations.DaprComponentResiliencyPoliciesOperations :ivar dapr_components: DaprComponentsOperations operations :vartype dapr_components: azure.mgmt.appcontainers.aio.operations.DaprComponentsOperations + :ivar dapr_subscriptions: DaprSubscriptionsOperations operations + :vartype dapr_subscriptions: + azure.mgmt.appcontainers.aio.operations.DaprSubscriptionsOperations + :ivar http_route_config: HttpRouteConfigOperations operations + :vartype http_route_config: azure.mgmt.appcontainers.aio.operations.HttpRouteConfigOperations + :ivar maintenance_configurations: MaintenanceConfigurationsOperations operations + :vartype maintenance_configurations: + azure.mgmt.appcontainers.aio.operations.MaintenanceConfigurationsOperations :ivar managed_environments_storages: ManagedEnvironmentsStoragesOperations operations :vartype managed_environments_storages: azure.mgmt.appcontainers.aio.operations.ManagedEnvironmentsStoragesOperations @@ -131,27 +203,29 @@ class ContainerAppsAPIClient(ContainerAppsAPIClientOperationsMixin): # pylint: azure.mgmt.appcontainers.aio.operations.ManagedEnvironmentUsagesOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The ID of the target subscription. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str - :keyword api_version: Api Version. Default value is "2025-01-01". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2025-02-02-preview". Note that overriding + this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = ContainerAppsAPIClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -170,12 +244,15 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, base_url), policies=_policies, **kwargs + ) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False + self.app_resiliency = AppResiliencyOperations(self._client, self._config, self._serialize, self._deserialize) self.container_apps_auth_configs = ContainerAppsAuthConfigsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -183,6 +260,12 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.billing_meters = BillingMetersOperations(self._client, self._config, self._serialize, self._deserialize) + self.builders = BuildersOperations(self._client, self._config, self._serialize, self._deserialize) + self.builds_by_builder_resource = BuildsByBuilderResourceOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.builds = BuildsOperations(self._client, self._config, self._serialize, self._deserialize) + self.build_auth_token = BuildAuthTokenOperations(self._client, self._config, self._serialize, self._deserialize) self.connected_environments = ConnectedEnvironmentsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -196,6 +279,18 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.container_apps = ContainerAppsOperations(self._client, self._config, self._serialize, self._deserialize) + self.container_apps_builds_by_container_app = ContainerAppsBuildsByContainerAppOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.container_apps_builds = ContainerAppsBuildsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.container_apps_label_history = ContainerAppsLabelHistoryOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.container_apps_patches = ContainerAppsPatchesOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.container_apps_revisions = ContainerAppsRevisionsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -212,9 +307,16 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) + self.dot_net_components = DotNetComponentsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.functions_extension = FunctionsExtensionOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.java_components = JavaComponentsOperations(self._client, self._config, self._serialize, self._deserialize) self.jobs_executions = JobsExecutionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.logic_apps = LogicAppsOperations(self._client, self._config, self._serialize, self._deserialize) self.managed_environments = ManagedEnvironmentsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -223,7 +325,25 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.namespaces = NamespacesOperations(self._client, self._config, self._serialize, self._deserialize) + self.managed_environment_private_endpoint_connections = ManagedEnvironmentPrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_environment_private_link_resources = ManagedEnvironmentPrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.dapr_component_resiliency_policies = DaprComponentResiliencyPoliciesOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.dapr_components = DaprComponentsOperations(self._client, self._config, self._serialize, self._deserialize) + self.dapr_subscriptions = DaprSubscriptionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.http_route_config = HttpRouteConfigOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.maintenance_configurations = MaintenanceConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.managed_environments_storages = ManagedEnvironmentsStoragesOperations( self._client, self._config, self._serialize, self._deserialize ) 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 dd207f7d68b8..7ae6a62ff715 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -12,29 +13,47 @@ if TYPE_CHECKING: from ._patch import * # pylint: disable=unused-wildcard-import +from ._app_resiliency_operations import AppResiliencyOperations # type: ignore from ._container_apps_auth_configs_operations import ContainerAppsAuthConfigsOperations # type: ignore from ._available_workload_profiles_operations import AvailableWorkloadProfilesOperations # type: ignore from ._billing_meters_operations import BillingMetersOperations # type: ignore +from ._builders_operations import BuildersOperations # type: ignore +from ._builds_by_builder_resource_operations import BuildsByBuilderResourceOperations # type: ignore +from ._builds_operations import BuildsOperations # type: ignore +from ._build_auth_token_operations import BuildAuthTokenOperations # type: ignore from ._connected_environments_operations import ConnectedEnvironmentsOperations # type: ignore from ._connected_environments_certificates_operations import ConnectedEnvironmentsCertificatesOperations # type: ignore from ._connected_environments_dapr_components_operations import ConnectedEnvironmentsDaprComponentsOperations # type: ignore from ._connected_environments_storages_operations import ConnectedEnvironmentsStoragesOperations # type: ignore from ._container_apps_operations import ContainerAppsOperations # type: ignore +from ._container_apps_builds_by_container_app_operations import ContainerAppsBuildsByContainerAppOperations # type: ignore +from ._container_apps_builds_operations import ContainerAppsBuildsOperations # type: ignore +from ._container_apps_label_history_operations import ContainerAppsLabelHistoryOperations # type: ignore +from ._container_apps_patches_operations import ContainerAppsPatchesOperations # type: ignore from ._container_apps_revisions_operations import ContainerAppsRevisionsOperations # type: ignore from ._container_apps_revision_replicas_operations import ContainerAppsRevisionReplicasOperations # type: ignore from ._container_apps_diagnostics_operations import ContainerAppsDiagnosticsOperations # type: ignore from ._managed_environment_diagnostics_operations import ManagedEnvironmentDiagnosticsOperations # type: ignore from ._managed_environments_diagnostics_operations import ManagedEnvironmentsDiagnosticsOperations # type: ignore from ._jobs_operations import JobsOperations # type: ignore +from ._dot_net_components_operations import DotNetComponentsOperations # type: ignore +from ._functions_extension_operations import FunctionsExtensionOperations # type: ignore from ._operations import Operations # type: ignore from ._java_components_operations import JavaComponentsOperations # type: ignore from ._jobs_executions_operations import JobsExecutionsOperations # type: ignore from ._container_apps_api_client_operations import ContainerAppsAPIClientOperationsMixin # type: ignore +from ._logic_apps_operations import LogicAppsOperations # type: ignore from ._managed_environments_operations import ManagedEnvironmentsOperations # type: ignore from ._certificates_operations import CertificatesOperations # type: ignore from ._managed_certificates_operations import ManagedCertificatesOperations # type: ignore from ._namespaces_operations import NamespacesOperations # type: ignore +from ._managed_environment_private_endpoint_connections_operations import ManagedEnvironmentPrivateEndpointConnectionsOperations # type: ignore +from ._managed_environment_private_link_resources_operations import ManagedEnvironmentPrivateLinkResourcesOperations # type: ignore +from ._dapr_component_resiliency_policies_operations import DaprComponentResiliencyPoliciesOperations # type: ignore from ._dapr_components_operations import DaprComponentsOperations # type: ignore +from ._dapr_subscriptions_operations import DaprSubscriptionsOperations # type: ignore +from ._http_route_config_operations import HttpRouteConfigOperations # type: ignore +from ._maintenance_configurations_operations import MaintenanceConfigurationsOperations # type: ignore from ._managed_environments_storages_operations import ManagedEnvironmentsStoragesOperations # type: ignore from ._container_apps_session_pools_operations import ContainerAppsSessionPoolsOperations # type: ignore from ._container_apps_source_controls_operations import ContainerAppsSourceControlsOperations # type: ignore @@ -46,29 +65,47 @@ from ._patch import patch_sdk as _patch_sdk __all__ = [ + "AppResiliencyOperations", "ContainerAppsAuthConfigsOperations", "AvailableWorkloadProfilesOperations", "BillingMetersOperations", + "BuildersOperations", + "BuildsByBuilderResourceOperations", + "BuildsOperations", + "BuildAuthTokenOperations", "ConnectedEnvironmentsOperations", "ConnectedEnvironmentsCertificatesOperations", "ConnectedEnvironmentsDaprComponentsOperations", "ConnectedEnvironmentsStoragesOperations", "ContainerAppsOperations", + "ContainerAppsBuildsByContainerAppOperations", + "ContainerAppsBuildsOperations", + "ContainerAppsLabelHistoryOperations", + "ContainerAppsPatchesOperations", "ContainerAppsRevisionsOperations", "ContainerAppsRevisionReplicasOperations", "ContainerAppsDiagnosticsOperations", "ManagedEnvironmentDiagnosticsOperations", "ManagedEnvironmentsDiagnosticsOperations", "JobsOperations", + "DotNetComponentsOperations", + "FunctionsExtensionOperations", "Operations", "JavaComponentsOperations", "JobsExecutionsOperations", "ContainerAppsAPIClientOperationsMixin", + "LogicAppsOperations", "ManagedEnvironmentsOperations", "CertificatesOperations", "ManagedCertificatesOperations", "NamespacesOperations", + "ManagedEnvironmentPrivateEndpointConnectionsOperations", + "ManagedEnvironmentPrivateLinkResourcesOperations", + "DaprComponentResiliencyPoliciesOperations", "DaprComponentsOperations", + "DaprSubscriptionsOperations", + "HttpRouteConfigOperations", + "MaintenanceConfigurationsOperations", "ManagedEnvironmentsStoragesOperations", "ContainerAppsSessionPoolsOperations", "ContainerAppsSourceControlsOperations", diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_app_resiliency_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_app_resiliency_operations.py new file mode 100644 index 000000000000..2c618098c4b1 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_app_resiliency_operations.py @@ -0,0 +1,558 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 collections.abc import MutableMapping +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core import AsyncPipelineClient +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._serialization import Deserializer, Serializer +from ...operations._app_resiliency_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, + build_update_request, +) +from .._configuration import ContainerAppsAPIClientConfiguration + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class AppResiliencyOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.aio.ContainerAppsAPIClient`'s + :attr:`app_resiliency` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerAppsAPIClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @overload + async def create_or_update( + self, + resource_group_name: str, + app_name: str, + name: str, + resiliency_envelope: _models.AppResiliency, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AppResiliency: + """Create or update an application's resiliency policy. + + Create or update container app resiliency policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_name: Name of the Container App. Required. + :type app_name: str + :param name: Name of the resiliency policy. Required. + :type name: str + :param resiliency_envelope: The resiliency policy to create or update. Required. + :type resiliency_envelope: ~azure.mgmt.appcontainers.models.AppResiliency + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: AppResiliency or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.AppResiliency + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + app_name: str, + name: str, + resiliency_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AppResiliency: + """Create or update an application's resiliency policy. + + Create or update container app resiliency policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_name: Name of the Container App. Required. + :type app_name: str + :param name: Name of the resiliency policy. Required. + :type name: str + :param resiliency_envelope: The resiliency policy to create or update. Required. + :type resiliency_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: AppResiliency or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.AppResiliency + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + app_name: str, + name: str, + resiliency_envelope: Union[_models.AppResiliency, IO[bytes]], + **kwargs: Any + ) -> _models.AppResiliency: + """Create or update an application's resiliency policy. + + Create or update container app resiliency policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_name: Name of the Container App. Required. + :type app_name: str + :param name: Name of the resiliency policy. Required. + :type name: str + :param resiliency_envelope: The resiliency policy to create or update. Is either a + AppResiliency type or a IO[bytes] type. Required. + :type resiliency_envelope: ~azure.mgmt.appcontainers.models.AppResiliency or IO[bytes] + :return: AppResiliency or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.AppResiliency + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AppResiliency] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(resiliency_envelope, (IOBase, bytes)): + _content = resiliency_envelope + else: + _json = self._serialize.body(resiliency_envelope, "AppResiliency") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + app_name=app_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AppResiliency", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def update( + self, + resource_group_name: str, + app_name: str, + name: str, + resiliency_envelope: _models.AppResiliency, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AppResiliency: + """Update an application's resiliency policy. + + Update container app resiliency policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_name: Name of the Container App. Required. + :type app_name: str + :param name: Name of the resiliency policy. Required. + :type name: str + :param resiliency_envelope: The resiliency policy to update. Required. + :type resiliency_envelope: ~azure.mgmt.appcontainers.models.AppResiliency + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: AppResiliency or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.AppResiliency + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + app_name: str, + name: str, + resiliency_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AppResiliency: + """Update an application's resiliency policy. + + Update container app resiliency policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_name: Name of the Container App. Required. + :type app_name: str + :param name: Name of the resiliency policy. Required. + :type name: str + :param resiliency_envelope: The resiliency policy to update. Required. + :type resiliency_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: AppResiliency or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.AppResiliency + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + app_name: str, + name: str, + resiliency_envelope: Union[_models.AppResiliency, IO[bytes]], + **kwargs: Any + ) -> _models.AppResiliency: + """Update an application's resiliency policy. + + Update container app resiliency policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_name: Name of the Container App. Required. + :type app_name: str + :param name: Name of the resiliency policy. Required. + :type name: str + :param resiliency_envelope: The resiliency policy to update. Is either a AppResiliency type or + a IO[bytes] type. Required. + :type resiliency_envelope: ~azure.mgmt.appcontainers.models.AppResiliency or IO[bytes] + :return: AppResiliency or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.AppResiliency + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AppResiliency] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(resiliency_envelope, (IOBase, bytes)): + _content = resiliency_envelope + else: + _json = self._serialize.body(resiliency_envelope, "AppResiliency") + + _request = build_update_request( + resource_group_name=resource_group_name, + app_name=app_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AppResiliency", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete(self, resource_group_name: str, app_name: str, name: str, **kwargs: Any) -> None: + """Delete an application's resiliency policy. + + Delete container app resiliency policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_name: Name of the Container App. Required. + :type app_name: str + :param name: Name of the resiliency policy. Required. + :type name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + app_name=app_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace_async + async def get(self, resource_group_name: str, app_name: str, name: str, **kwargs: Any) -> _models.AppResiliency: + """Get an application's resiliency policy. + + Get container app resiliency policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_name: Name of the Container App. Required. + :type app_name: str + :param name: Name of the resiliency policy. Required. + :type name: str + :return: AppResiliency or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.AppResiliency + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AppResiliency] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + app_name=app_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AppResiliency", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list(self, resource_group_name: str, app_name: str, **kwargs: Any) -> AsyncIterable["_models.AppResiliency"]: + """List an application's resiliency policies. + + List container app resiliency policies. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_name: Name of the Container App. Required. + :type app_name: str + :return: An iterator like instance of either AppResiliency or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.AppResiliency] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AppResiliencyCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + app_name=app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("AppResiliencyCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_available_workload_profiles_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_available_workload_profiles_operations.py index 6158881a4b84..a00637f4dd1c 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 @@ -5,10 +5,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from collections.abc import MutableMapping from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -25,12 +26,10 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ..._serialization import Deserializer, Serializer from ...operations._available_workload_profiles_operations import build_get_request +from .._configuration import ContainerAppsAPIClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -49,10 +48,10 @@ class AvailableWorkloadProfilesOperations: 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") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerAppsAPIClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def get(self, location: str, **kwargs: Any) -> AsyncIterable["_models.AvailableWorkloadProfile"]: 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 9b68807a08ee..b19e6363b1d8 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 @@ -5,9 +5,10 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from collections.abc import MutableMapping from typing import Any, Callable, Dict, Optional, TypeVar +from azure.core import AsyncPipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -23,12 +24,10 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ..._serialization import Deserializer, Serializer from ...operations._billing_meters_operations import build_get_request +from .._configuration import ContainerAppsAPIClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -47,10 +46,10 @@ class BillingMetersOperations: 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") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerAppsAPIClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async async def get(self, location: str, **kwargs: Any) -> _models.BillingMeterCollection: diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_build_auth_token_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_build_auth_token_operations.py new file mode 100644 index 000000000000..a388bef3d460 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_build_auth_token_operations.py @@ -0,0 +1,113 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 collections.abc import MutableMapping +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core import AsyncPipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._serialization import Deserializer, Serializer +from ...operations._build_auth_token_operations import build_list_request +from .._configuration import ContainerAppsAPIClientConfiguration + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class BuildAuthTokenOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.aio.ContainerAppsAPIClient`'s + :attr:`build_auth_token` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerAppsAPIClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def list( + self, resource_group_name: str, builder_name: str, build_name: str, **kwargs: Any + ) -> _models.BuildToken: + """Gets the token used to connect to the endpoint where source code can be uploaded for a build. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param build_name: The name of a build. Required. + :type build_name: str + :return: BuildToken or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.BuildToken + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BuildToken] = kwargs.pop("cls", None) + + _request = build_list_request( + resource_group_name=resource_group_name, + builder_name=builder_name, + build_name=build_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("BuildToken", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_builders_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_builders_operations.py new file mode 100644 index 000000000000..af66c3f284bc --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_builders_operations.py @@ -0,0 +1,790 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 collections.abc import MutableMapping +from io import IOBase +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core import AsyncPipelineClient +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._serialization import Deserializer, Serializer +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 .._configuration import ContainerAppsAPIClientConfiguration + +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: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerAppsAPIClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.BuilderResource"]: + """List BuilderResource resources by subscription ID. + + :return: An iterator like instance of either BuilderResource or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.BuilderResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BuilderCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("BuilderCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.BuilderResource"]: + """List BuilderResource resources by resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of either BuilderResource or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.BuilderResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BuilderCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("BuilderCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get(self, resource_group_name: str, builder_name: str, **kwargs: Any) -> _models.BuilderResource: + """Get a BuilderResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :return: BuilderResource or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.BuilderResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + builder_name=builder_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("BuilderResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + builder_name: str, + builder_envelope: Union[_models.BuilderResource, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(builder_envelope, (IOBase, bytes)): + _content = builder_envelope + else: + _json = self._serialize.body(builder_envelope, "BuilderResource") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + builder_name=builder_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + builder_name: str, + builder_envelope: _models.BuilderResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.BuilderResource]: + """Create or update a BuilderResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param builder_envelope: Resource create parameters. Required. + :type builder_envelope: ~azure.mgmt.appcontainers.models.BuilderResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either BuilderResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.BuilderResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + builder_name: str, + builder_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.BuilderResource]: + """Create or update a BuilderResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param builder_envelope: Resource create parameters. Required. + :type builder_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either BuilderResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.BuilderResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + builder_name: str, + builder_envelope: Union[_models.BuilderResource, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.BuilderResource]: + """Create or update a BuilderResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param builder_envelope: Resource create parameters. Is either a BuilderResource type or a + IO[bytes] type. Required. + :type builder_envelope: ~azure.mgmt.appcontainers.models.BuilderResource or IO[bytes] + :return: An instance of AsyncLROPoller that returns either BuilderResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.BuilderResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + builder_name=builder_name, + builder_envelope=builder_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("BuilderResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.BuilderResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.BuilderResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _update_initial( + self, + resource_group_name: str, + builder_name: str, + builder_envelope: Union[_models.BuilderResourceUpdate, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(builder_envelope, (IOBase, bytes)): + _content = builder_envelope + else: + _json = self._serialize.body(builder_envelope, "BuilderResourceUpdate") + + _request = build_update_request( + resource_group_name=resource_group_name, + builder_name=builder_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + builder_name: str, + builder_envelope: _models.BuilderResourceUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.BuilderResource]: + """Update a BuilderResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param builder_envelope: The resource properties to be updated. Required. + :type builder_envelope: ~azure.mgmt.appcontainers.models.BuilderResourceUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either BuilderResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.BuilderResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + builder_name: str, + builder_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.BuilderResource]: + """Update a BuilderResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param builder_envelope: The resource properties to be updated. Required. + :type builder_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either BuilderResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.BuilderResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + builder_name: str, + builder_envelope: Union[_models.BuilderResourceUpdate, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.BuilderResource]: + """Update a BuilderResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param builder_envelope: The resource properties to be updated. Is either a + BuilderResourceUpdate type or a IO[bytes] type. Required. + :type builder_envelope: ~azure.mgmt.appcontainers.models.BuilderResourceUpdate or IO[bytes] + :return: An instance of AsyncLROPoller that returns either BuilderResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.BuilderResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + builder_name=builder_name, + builder_envelope=builder_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("BuilderResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.BuilderResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.BuilderResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial(self, resource_group_name: str, builder_name: str, **kwargs: Any) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + builder_name=builder_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete(self, resource_group_name: str, builder_name: str, **kwargs: Any) -> AsyncLROPoller[None]: + """Delete a BuilderResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + builder_name=builder_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_builds_by_builder_resource_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_builds_by_builder_resource_operations.py new file mode 100644 index 000000000000..19d0b8649b8d --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_builds_by_builder_resource_operations.py @@ -0,0 +1,138 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 collections.abc import MutableMapping +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse + +from azure.core import AsyncPipelineClient +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._serialization import Deserializer, Serializer +from ...operations._builds_by_builder_resource_operations import build_list_request +from .._configuration import ContainerAppsAPIClientConfiguration + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class BuildsByBuilderResourceOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.aio.ContainerAppsAPIClient`'s + :attr:`builds_by_builder_resource` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerAppsAPIClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, resource_group_name: str, builder_name: str, **kwargs: Any + ) -> AsyncIterable["_models.BuildResource"]: + """List BuildResource resources by BuilderResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :return: An iterator like instance of either BuildResource or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.BuildResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BuildCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + builder_name=builder_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("BuildCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_builds_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_builds_operations.py new file mode 100644 index 000000000000..7a93cd21df1d --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_builds_operations.py @@ -0,0 +1,448 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 collections.abc import MutableMapping +from io import IOBase +from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core import AsyncPipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._serialization import Deserializer, Serializer +from ...operations._builds_operations import build_create_or_update_request, build_delete_request, build_get_request +from .._configuration import ContainerAppsAPIClientConfiguration + +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: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerAppsAPIClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, resource_group_name: str, builder_name: str, build_name: str, **kwargs: Any + ) -> _models.BuildResource: + """Get a BuildResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param build_name: The name of a build. Required. + :type build_name: str + :return: BuildResource or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.BuildResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BuildResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + builder_name=builder_name, + build_name=build_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("BuildResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + builder_name: str, + build_name: str, + build_envelope: Union[_models.BuildResource, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(build_envelope, (IOBase, bytes)): + _content = build_envelope + else: + _json = self._serialize.body(build_envelope, "BuildResource") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + builder_name=builder_name, + build_name=build_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + builder_name: str, + build_name: str, + build_envelope: _models.BuildResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.BuildResource]: + """Create a BuildResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param build_name: The name of a build. Required. + :type build_name: str + :param build_envelope: Resource create or update parameters. Required. + :type build_envelope: ~azure.mgmt.appcontainers.models.BuildResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either BuildResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.BuildResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + builder_name: str, + build_name: str, + build_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.BuildResource]: + """Create a BuildResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param build_name: The name of a build. Required. + :type build_name: str + :param build_envelope: Resource create or update parameters. Required. + :type build_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either BuildResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.BuildResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + builder_name: str, + build_name: str, + build_envelope: Union[_models.BuildResource, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.BuildResource]: + """Create a BuildResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param build_name: The name of a build. Required. + :type build_name: str + :param build_envelope: Resource create or update parameters. Is either a BuildResource type or + a IO[bytes] type. Required. + :type build_envelope: ~azure.mgmt.appcontainers.models.BuildResource or IO[bytes] + :return: An instance of AsyncLROPoller that returns either BuildResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.BuildResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BuildResource] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + builder_name=builder_name, + build_name=build_name, + build_envelope=build_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("BuildResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.BuildResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.BuildResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, resource_group_name: str, builder_name: str, build_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + builder_name=builder_name, + build_name=build_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, builder_name: str, build_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a BuildResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param build_name: The name of a build. Required. + :type build_name: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + builder_name=builder_name, + build_name=build_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_certificates_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_certificates_operations.py index e70e891c4fe2..998cc3cadb8f 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 @@ -5,11 +5,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +28,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ..._serialization import Deserializer, Serializer from ...operations._certificates_operations import ( build_create_or_update_request, build_delete_request, @@ -34,11 +36,8 @@ build_list_request, build_update_request, ) +from .._configuration import ContainerAppsAPIClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -57,10 +56,10 @@ class CertificatesOperations: 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") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerAppsAPIClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list( 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 dcc1bffde0aa..c99f356228c0 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 @@ -5,11 +5,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -17,16 +18,21 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models +from ..._serialization import Deserializer, Serializer from ...operations._connected_environments_certificates_operations import ( build_create_or_update_request, build_delete_request, @@ -34,11 +40,8 @@ build_list_request, build_update_request, ) +from .._configuration import ContainerAppsAPIClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -57,10 +60,10 @@ class ConnectedEnvironmentsCertificatesOperations: # pylint: disable=name-too-l 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") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerAppsAPIClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list( @@ -211,8 +214,80 @@ async def get( return deserialized # type: ignore + async def _create_or_update_initial( + self, + resource_group_name: str, + connected_environment_name: str, + certificate_name: str, + certificate_envelope: Optional[Union[_models.Certificate, IO[bytes]]] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(certificate_envelope, (IOBase, bytes)): + _content = certificate_envelope + else: + if certificate_envelope is not None: + _json = self._serialize.body(certificate_envelope, "Certificate") + else: + _json = None + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + connected_environment_name=connected_environment_name, + certificate_name=certificate_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + @overload - async def create_or_update( + async def begin_create_or_update( self, resource_group_name: str, connected_environment_name: str, @@ -221,7 +296,7 @@ async def create_or_update( *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Certificate: + ) -> AsyncLROPoller[_models.Certificate]: """Create or Update a Certificate. Create or Update a Certificate. @@ -238,13 +313,14 @@ async def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: Certificate or the result of cls(response) - :rtype: ~azure.mgmt.appcontainers.models.Certificate + :return: An instance of AsyncLROPoller that returns either Certificate or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.Certificate] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def create_or_update( + async def begin_create_or_update( self, resource_group_name: str, connected_environment_name: str, @@ -253,7 +329,7 @@ async def create_or_update( *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Certificate: + ) -> AsyncLROPoller[_models.Certificate]: """Create or Update a Certificate. Create or Update a Certificate. @@ -270,20 +346,21 @@ async def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: Certificate or the result of cls(response) - :rtype: ~azure.mgmt.appcontainers.models.Certificate + :return: An instance of AsyncLROPoller that returns either Certificate or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.Certificate] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def create_or_update( + async def begin_create_or_update( self, resource_group_name: str, connected_environment_name: str, certificate_name: str, certificate_envelope: Optional[Union[_models.Certificate, IO[bytes]]] = None, **kwargs: Any - ) -> _models.Certificate: + ) -> AsyncLROPoller[_models.Certificate]: """Create or Update a Certificate. Create or Update a Certificate. @@ -298,10 +375,65 @@ async def create_or_update( :param certificate_envelope: Certificate to be created or updated. Is either a Certificate type or a IO[bytes] type. Default value is None. :type certificate_envelope: ~azure.mgmt.appcontainers.models.Certificate or IO[bytes] - :return: Certificate or the result of cls(response) - :rtype: ~azure.mgmt.appcontainers.models.Certificate + :return: An instance of AsyncLROPoller that returns either Certificate or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.Certificate] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Certificate] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + connected_environment_name=connected_environment_name, + certificate_name=certificate_name, + certificate_envelope=certificate_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Certificate", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.Certificate].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.Certificate]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, resource_group_name: str, connected_environment_name: str, certificate_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -310,61 +442,55 @@ async def create_or_update( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Certificate] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(certificate_envelope, (IOBase, bytes)): - _content = certificate_envelope - else: - if certificate_envelope is not None: - _json = self._serialize.body(certificate_envelope, "Certificate") - else: - _json = None + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_create_or_update_request( + _request = build_delete_request( resource_group_name=resource_group_name, connected_environment_name=connected_environment_name, certificate_name=certificate_name, subscription_id=self._config.subscription_id, api_version=api_version, - content_type=content_type, - json=_json, - content=_content, headers=_headers, params=_params, ) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response.http_response) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @distributed_trace_async - async def delete( + async def begin_delete( self, resource_group_name: str, connected_environment_name: str, certificate_name: str, **kwargs: Any - ) -> None: + ) -> AsyncLROPoller[None]: """Deletes the specified Certificate. Deletes the specified Certificate. @@ -376,10 +502,61 @@ async def delete( :type connected_environment_name: str :param certificate_name: Name of the Certificate. Required. :type certificate_name: str - :return: None or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + connected_environment_name=connected_environment_name, + certificate_name=certificate_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + connected_environment_name: str, + certificate_name: str, + certificate_envelope: Union[_models.CertificatePatch, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -388,40 +565,65 @@ async def delete( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_delete_request( + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(certificate_envelope, (IOBase, bytes)): + _content = certificate_envelope + else: + _json = self._serialize.body(certificate_envelope, "CertificatePatch") + + _request = build_update_request( resource_group_name=resource_group_name, connected_environment_name=connected_environment_name, certificate_name=certificate_name, subscription_id=self._config.subscription_id, api_version=api_version, + content_type=content_type, + json=_json, + content=_content, headers=_headers, params=_params, ) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 204]: + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @overload - async def update( + async def begin_update( self, resource_group_name: str, connected_environment_name: str, @@ -430,7 +632,7 @@ async def update( *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Certificate: + ) -> AsyncLROPoller[_models.Certificate]: """Update properties of a certificate. Patches a certificate. Currently only patching of tags is supported. @@ -447,13 +649,14 @@ async def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: Certificate or the result of cls(response) - :rtype: ~azure.mgmt.appcontainers.models.Certificate + :return: An instance of AsyncLROPoller that returns either Certificate or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.Certificate] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def update( + async def begin_update( self, resource_group_name: str, connected_environment_name: str, @@ -462,7 +665,7 @@ async def update( *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Certificate: + ) -> AsyncLROPoller[_models.Certificate]: """Update properties of a certificate. Patches a certificate. Currently only patching of tags is supported. @@ -479,20 +682,21 @@ async def update( :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: Certificate or the result of cls(response) - :rtype: ~azure.mgmt.appcontainers.models.Certificate + :return: An instance of AsyncLROPoller that returns either Certificate or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.Certificate] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def update( + async def begin_update( self, resource_group_name: str, connected_environment_name: str, certificate_name: str, certificate_envelope: Union[_models.CertificatePatch, IO[bytes]], **kwargs: Any - ) -> _models.Certificate: + ) -> AsyncLROPoller[_models.Certificate]: """Update properties of a certificate. Patches a certificate. Currently only patching of tags is supported. @@ -507,62 +711,57 @@ async def update( :param certificate_envelope: Properties of a certificate that need to be updated. Is either a CertificatePatch type or a IO[bytes] type. Required. :type certificate_envelope: ~azure.mgmt.appcontainers.models.CertificatePatch or IO[bytes] - :return: Certificate or the result of cls(response) - :rtype: ~azure.mgmt.appcontainers.models.Certificate + :return: An instance of AsyncLROPoller that returns either Certificate or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.Certificate] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Certificate] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + connected_environment_name=connected_environment_name, + certificate_name=certificate_name, + certificate_envelope=certificate_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(certificate_envelope, (IOBase, bytes)): - _content = certificate_envelope - else: - _json = self._serialize.body(certificate_envelope, "CertificatePatch") - - _request = build_update_request( - resource_group_name=resource_group_name, - connected_environment_name=connected_environment_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Certificate", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.Certificate].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.Certificate]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Certificate", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_connected_environments_dapr_components_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_connected_environments_dapr_components_operations.py index 2354bc86bc30..86ac9606d95c 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 @@ -5,11 +5,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -17,16 +18,21 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models +from ..._serialization import Deserializer, Serializer from ...operations._connected_environments_dapr_components_operations import ( build_create_or_update_request, build_delete_request, @@ -34,11 +40,8 @@ build_list_request, build_list_secrets_request, ) +from .._configuration import ContainerAppsAPIClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -57,15 +60,15 @@ class ConnectedEnvironmentsDaprComponentsOperations: # pylint: disable=name-too 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") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerAppsAPIClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list( self, resource_group_name: str, connected_environment_name: str, **kwargs: Any - ) -> AsyncIterable["_models.DaprComponent"]: + ) -> AsyncIterable["_models.ConnectedEnvironmentDaprComponent"]: """Get the Dapr Components for a connected environment. Get the Dapr Components for a connected environment. @@ -75,15 +78,17 @@ def list( :type resource_group_name: str :param connected_environment_name: Name of the connected environment. Required. :type connected_environment_name: str - :return: An iterator like instance of either DaprComponent or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.DaprComponent] + :return: An iterator like instance of either ConnectedEnvironmentDaprComponent or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.ConnectedEnvironmentDaprComponent] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.DaprComponentsCollection] = kwargs.pop("cls", None) + cls: ClsType[_models.ConnectedEnvironmentDaprComponentsCollection] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -124,7 +129,7 @@ def prepare_request(next_link=None): return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("DaprComponentsCollection", pipeline_response) + deserialized = self._deserialize("ConnectedEnvironmentDaprComponentsCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -151,7 +156,7 @@ async def get_next(next_link=None): @distributed_trace_async async def get( self, resource_group_name: str, connected_environment_name: str, component_name: str, **kwargs: Any - ) -> _models.DaprComponent: + ) -> _models.ConnectedEnvironmentDaprComponent: """Get a dapr component. Get a dapr component. @@ -163,8 +168,8 @@ async def get( :type connected_environment_name: str :param component_name: Name of the Dapr Component. Required. :type component_name: str - :return: DaprComponent or the result of cls(response) - :rtype: ~azure.mgmt.appcontainers.models.DaprComponent + :return: ConnectedEnvironmentDaprComponent or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.ConnectedEnvironmentDaprComponent :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -179,7 +184,7 @@ async def get( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.DaprComponent] = kwargs.pop("cls", None) + cls: ClsType[_models.ConnectedEnvironmentDaprComponent] = kwargs.pop("cls", None) _request = build_get_request( resource_group_name=resource_group_name, @@ -204,7 +209,76 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DaprComponent", pipeline_response.http_response) + deserialized = self._deserialize("ConnectedEnvironmentDaprComponent", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + connected_environment_name: str, + component_name: str, + dapr_component_envelope: Union[_models.ConnectedEnvironmentDaprComponent, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(dapr_component_envelope, (IOBase, bytes)): + _content = dapr_component_envelope + else: + _json = self._serialize.body(dapr_component_envelope, "ConnectedEnvironmentDaprComponent") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + connected_environment_name=connected_environment_name, + component_name=component_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -212,16 +286,16 @@ async def get( return deserialized # type: ignore @overload - async def create_or_update( + async def begin_create_or_update( self, resource_group_name: str, connected_environment_name: str, component_name: str, - dapr_component_envelope: _models.DaprComponent, + dapr_component_envelope: _models.ConnectedEnvironmentDaprComponent, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.DaprComponent: + ) -> AsyncLROPoller[_models.ConnectedEnvironmentDaprComponent]: """Creates or updates a Dapr Component. Creates or updates a Dapr Component in a connected environment. @@ -234,17 +308,20 @@ async def create_or_update( :param component_name: Name of the Dapr Component. Required. :type component_name: str :param dapr_component_envelope: Configuration details of the Dapr Component. Required. - :type dapr_component_envelope: ~azure.mgmt.appcontainers.models.DaprComponent + :type dapr_component_envelope: + ~azure.mgmt.appcontainers.models.ConnectedEnvironmentDaprComponent :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: DaprComponent or the result of cls(response) - :rtype: ~azure.mgmt.appcontainers.models.DaprComponent + :return: An instance of AsyncLROPoller that returns either ConnectedEnvironmentDaprComponent or + the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.ConnectedEnvironmentDaprComponent] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def create_or_update( + async def begin_create_or_update( self, resource_group_name: str, connected_environment_name: str, @@ -253,7 +330,7 @@ async def create_or_update( *, content_type: str = "application/json", **kwargs: Any - ) -> _models.DaprComponent: + ) -> AsyncLROPoller[_models.ConnectedEnvironmentDaprComponent]: """Creates or updates a Dapr Component. Creates or updates a Dapr Component in a connected environment. @@ -270,20 +347,22 @@ async def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: DaprComponent or the result of cls(response) - :rtype: ~azure.mgmt.appcontainers.models.DaprComponent + :return: An instance of AsyncLROPoller that returns either ConnectedEnvironmentDaprComponent or + the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.ConnectedEnvironmentDaprComponent] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def create_or_update( + async def begin_create_or_update( self, resource_group_name: str, connected_environment_name: str, component_name: str, - dapr_component_envelope: Union[_models.DaprComponent, IO[bytes]], + dapr_component_envelope: Union[_models.ConnectedEnvironmentDaprComponent, IO[bytes]], **kwargs: Any - ) -> _models.DaprComponent: + ) -> AsyncLROPoller[_models.ConnectedEnvironmentDaprComponent]: """Creates or updates a Dapr Component. Creates or updates a Dapr Component in a connected environment. @@ -296,12 +375,69 @@ async def create_or_update( :param component_name: Name of the Dapr Component. Required. :type component_name: str :param dapr_component_envelope: Configuration details of the Dapr Component. Is either a - DaprComponent type or a IO[bytes] type. Required. - :type dapr_component_envelope: ~azure.mgmt.appcontainers.models.DaprComponent or IO[bytes] - :return: DaprComponent or the result of cls(response) - :rtype: ~azure.mgmt.appcontainers.models.DaprComponent + ConnectedEnvironmentDaprComponent type or a IO[bytes] type. Required. + :type dapr_component_envelope: + ~azure.mgmt.appcontainers.models.ConnectedEnvironmentDaprComponent or IO[bytes] + :return: An instance of AsyncLROPoller that returns either ConnectedEnvironmentDaprComponent or + the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.ConnectedEnvironmentDaprComponent] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConnectedEnvironmentDaprComponent] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + connected_environment_name=connected_environment_name, + component_name=component_name, + dapr_component_envelope=dapr_component_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ConnectedEnvironmentDaprComponent", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.ConnectedEnvironmentDaprComponent].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ConnectedEnvironmentDaprComponent]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, resource_group_name: str, connected_environment_name: str, component_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -310,58 +446,55 @@ async def create_or_update( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DaprComponent] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(dapr_component_envelope, (IOBase, bytes)): - _content = dapr_component_envelope - else: - _json = self._serialize.body(dapr_component_envelope, "DaprComponent") - - _request = build_create_or_update_request( + _request = build_delete_request( resource_group_name=resource_group_name, connected_environment_name=connected_environment_name, component_name=component_name, subscription_id=self._config.subscription_id, api_version=api_version, - content_type=content_type, - json=_json, - content=_content, headers=_headers, params=_params, ) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DaprComponent", pipeline_response.http_response) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @distributed_trace_async - async def delete( + async def begin_delete( self, resource_group_name: str, connected_environment_name: str, component_name: str, **kwargs: Any - ) -> None: + ) -> AsyncLROPoller[None]: """Delete a Dapr Component. Delete a Dapr Component from a connected environment. @@ -373,49 +506,52 @@ async def delete( :type connected_environment_name: str :param component_name: Name of the Dapr Component. Required. :type component_name: str - :return: None or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + connected_environment_name=connected_environment_name, + component_name=component_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) - _request = build_delete_request( - resource_group_name=resource_group_name, - connected_environment_name=connected_environment_name, - component_name=component_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore - if cls: - return cls(pipeline_response, None, {}) # type: ignore + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace_async async def list_secrets( diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_connected_environments_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_connected_environments_operations.py index edce9388db12..1313c88425fa 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 @@ -5,11 +5,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -31,6 +32,7 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models +from ..._serialization import Deserializer, Serializer from ...operations._connected_environments_operations import ( build_check_name_availability_request, build_create_or_update_request, @@ -40,11 +42,8 @@ build_list_by_subscription_request, build_update_request, ) +from .._configuration import ContainerAppsAPIClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -63,10 +62,10 @@ class ConnectedEnvironmentsOperations: 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") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerAppsAPIClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.ConnectedEnvironment"]: @@ -601,9 +600,73 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + @overload + async def update( + self, + resource_group_name: str, + connected_environment_name: str, + environment_envelope: Optional[_models.ConnectedEnvironmentPatchResource] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ConnectedEnvironment: + """Update connected Environment's properties. + + Patches a Managed Environment. Only patching of tags is supported currently. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param connected_environment_name: Name of the connectedEnvironment. Required. + :type connected_environment_name: str + :param environment_envelope: Configuration details of the connectedEnvironment. Default value + is None. + :type environment_envelope: ~azure.mgmt.appcontainers.models.ConnectedEnvironmentPatchResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ConnectedEnvironment or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.ConnectedEnvironment + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + connected_environment_name: str, + environment_envelope: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ConnectedEnvironment: + """Update connected Environment's properties. + + Patches a Managed Environment. Only patching of tags is supported currently. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param connected_environment_name: Name of the connectedEnvironment. Required. + :type connected_environment_name: str + :param environment_envelope: Configuration details of the connectedEnvironment. Default value + is None. + :type environment_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ConnectedEnvironment or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.ConnectedEnvironment + :raises ~azure.core.exceptions.HttpResponseError: + """ + @distributed_trace_async async def update( - self, resource_group_name: str, connected_environment_name: str, **kwargs: Any + self, + resource_group_name: str, + connected_environment_name: str, + environment_envelope: Optional[Union[_models.ConnectedEnvironmentPatchResource, IO[bytes]]] = None, + **kwargs: Any ) -> _models.ConnectedEnvironment: """Update connected Environment's properties. @@ -614,6 +677,10 @@ async def update( :type resource_group_name: str :param connected_environment_name: Name of the connectedEnvironment. Required. :type connected_environment_name: str + :param environment_envelope: Configuration details of the connectedEnvironment. Is either a + ConnectedEnvironmentPatchResource type or a IO[bytes] type. Default value is None. + :type environment_envelope: ~azure.mgmt.appcontainers.models.ConnectedEnvironmentPatchResource + or IO[bytes] :return: ConnectedEnvironment or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.ConnectedEnvironment :raises ~azure.core.exceptions.HttpResponseError: @@ -626,17 +693,32 @@ async def update( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ConnectedEnvironment] = kwargs.pop("cls", None) + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(environment_envelope, (IOBase, bytes)): + _content = environment_envelope + else: + if environment_envelope is not None: + _json = self._serialize.body(environment_envelope, "ConnectedEnvironmentPatchResource") + else: + _json = None + _request = build_update_request( resource_group_name=resource_group_name, connected_environment_name=connected_environment_name, subscription_id=self._config.subscription_id, api_version=api_version, + content_type=content_type, + json=_json, + content=_content, headers=_headers, params=_params, ) 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 c12784f78263..b7edcbb671cf 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 @@ -5,36 +5,39 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from azure.core import AsyncPipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models +from ..._serialization import Deserializer, Serializer from ...operations._connected_environments_storages_operations import ( build_create_or_update_request, build_delete_request, build_get_request, build_list_request, ) +from .._configuration import ContainerAppsAPIClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -53,10 +56,10 @@ class ConnectedEnvironmentsStoragesOperations: 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") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerAppsAPIClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async async def list( @@ -181,8 +184,77 @@ async def get( return deserialized # type: ignore + async def _create_or_update_initial( + self, + resource_group_name: str, + connected_environment_name: str, + storage_name: str, + storage_envelope: Union[_models.ConnectedEnvironmentStorage, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(storage_envelope, (IOBase, bytes)): + _content = storage_envelope + else: + _json = self._serialize.body(storage_envelope, "ConnectedEnvironmentStorage") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + connected_environment_name=connected_environment_name, + storage_name=storage_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + @overload - async def create_or_update( + async def begin_create_or_update( self, resource_group_name: str, connected_environment_name: str, @@ -191,7 +263,7 @@ async def create_or_update( *, content_type: str = "application/json", **kwargs: Any - ) -> _models.ConnectedEnvironmentStorage: + ) -> AsyncLROPoller[_models.ConnectedEnvironmentStorage]: """Create or update storage for a connectedEnvironment. Create or update storage for a connectedEnvironment. @@ -208,13 +280,15 @@ async def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: ConnectedEnvironmentStorage or the result of cls(response) - :rtype: ~azure.mgmt.appcontainers.models.ConnectedEnvironmentStorage + :return: An instance of AsyncLROPoller that returns either ConnectedEnvironmentStorage or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.ConnectedEnvironmentStorage] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def create_or_update( + async def begin_create_or_update( self, resource_group_name: str, connected_environment_name: str, @@ -223,7 +297,7 @@ async def create_or_update( *, content_type: str = "application/json", **kwargs: Any - ) -> _models.ConnectedEnvironmentStorage: + ) -> AsyncLROPoller[_models.ConnectedEnvironmentStorage]: """Create or update storage for a connectedEnvironment. Create or update storage for a connectedEnvironment. @@ -240,20 +314,22 @@ async def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: ConnectedEnvironmentStorage or the result of cls(response) - :rtype: ~azure.mgmt.appcontainers.models.ConnectedEnvironmentStorage + :return: An instance of AsyncLROPoller that returns either ConnectedEnvironmentStorage or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.ConnectedEnvironmentStorage] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def create_or_update( + async def begin_create_or_update( self, resource_group_name: str, connected_environment_name: str, storage_name: str, storage_envelope: Union[_models.ConnectedEnvironmentStorage, IO[bytes]], **kwargs: Any - ) -> _models.ConnectedEnvironmentStorage: + ) -> AsyncLROPoller[_models.ConnectedEnvironmentStorage]: """Create or update storage for a connectedEnvironment. Create or update storage for a connectedEnvironment. @@ -269,10 +345,66 @@ async def create_or_update( ConnectedEnvironmentStorage type or a IO[bytes] type. Required. :type storage_envelope: ~azure.mgmt.appcontainers.models.ConnectedEnvironmentStorage or IO[bytes] - :return: ConnectedEnvironmentStorage or the result of cls(response) - :rtype: ~azure.mgmt.appcontainers.models.ConnectedEnvironmentStorage + :return: An instance of AsyncLROPoller that returns either ConnectedEnvironmentStorage or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.ConnectedEnvironmentStorage] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConnectedEnvironmentStorage] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + connected_environment_name=connected_environment_name, + storage_name=storage_name, + storage_envelope=storage_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ConnectedEnvironmentStorage", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.ConnectedEnvironmentStorage].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ConnectedEnvironmentStorage]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, resource_group_name: str, connected_environment_name: str, storage_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -281,58 +413,55 @@ async def create_or_update( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConnectedEnvironmentStorage] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(storage_envelope, (IOBase, bytes)): - _content = storage_envelope - else: - _json = self._serialize.body(storage_envelope, "ConnectedEnvironmentStorage") - - _request = build_create_or_update_request( + _request = build_delete_request( resource_group_name=resource_group_name, connected_environment_name=connected_environment_name, storage_name=storage_name, subscription_id=self._config.subscription_id, api_version=api_version, - content_type=content_type, - json=_json, - content=_content, headers=_headers, params=_params, ) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectedEnvironmentStorage", pipeline_response.http_response) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @distributed_trace_async - async def delete( + async def begin_delete( self, resource_group_name: str, connected_environment_name: str, storage_name: str, **kwargs: Any - ) -> None: + ) -> AsyncLROPoller[None]: """Delete storage for a connectedEnvironment. Delete storage for a connectedEnvironment. @@ -344,46 +473,49 @@ async def delete( :type connected_environment_name: str :param storage_name: Name of the storage. Required. :type storage_name: str - :return: None or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - connected_environment_name=connected_environment_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + connected_environment_name=connected_environment_name, + storage_name=storage_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_api_client_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_api_client_operations.py index fa7cd87c6973..477c3b567a66 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_api_client_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_api_client_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from collections.abc import MutableMapping from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -29,10 +30,6 @@ ) from .._vendor import ContainerAppsAPIClientMixinABC -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore 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_auth_configs_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_auth_configs_operations.py index f05220d72ad5..0fdad2aa6c98 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 @@ -5,11 +5,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,17 +28,15 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ..._serialization import Deserializer, Serializer from ...operations._container_apps_auth_configs_operations import ( build_create_or_update_request, build_delete_request, build_get_request, build_list_by_container_app_request, ) +from .._configuration import ContainerAppsAPIClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,10 +55,10 @@ class ContainerAppsAuthConfigsOperations: 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") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerAppsAPIClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list_by_container_app( diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_builds_by_container_app_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_builds_by_container_app_operations.py new file mode 100644 index 000000000000..ae9d9261ad7c --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_builds_by_container_app_operations.py @@ -0,0 +1,140 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from collections.abc import MutableMapping +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse + +from azure.core import AsyncPipelineClient +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._serialization import Deserializer, Serializer +from ...operations._container_apps_builds_by_container_app_operations import build_list_request +from .._configuration import ContainerAppsAPIClientConfiguration + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ContainerAppsBuildsByContainerAppOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.aio.ContainerAppsAPIClient`'s + :attr:`container_apps_builds_by_container_app` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerAppsAPIClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, resource_group_name: str, container_app_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ContainerAppsBuildResource"]: + """List Container Apps Build resources by Container App. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App the Build is associated. Required. + :type container_app_name: str + :return: An iterator like instance of either ContainerAppsBuildResource or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.ContainerAppsBuildResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ContainerAppsBuildCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ContainerAppsBuildCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_builds_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_builds_operations.py new file mode 100644 index 000000000000..dfd169a96d20 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_builds_operations.py @@ -0,0 +1,233 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 collections.abc import MutableMapping +from typing import Any, AsyncIterator, Callable, Dict, Optional, TypeVar, Union, cast + +from azure.core import AsyncPipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._serialization import Deserializer, Serializer +from ...operations._container_apps_builds_operations import build_delete_request, build_get_request +from .._configuration import ContainerAppsAPIClientConfiguration + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ContainerAppsBuildsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.aio.ContainerAppsAPIClient`'s + :attr:`container_apps_builds` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerAppsAPIClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, resource_group_name: str, container_app_name: str, build_name: str, **kwargs: Any + ) -> _models.ContainerAppsBuildResource: + """Get a Container Apps Build resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App the Build is associated. Required. + :type container_app_name: str + :param build_name: The name of a build. Required. + :type build_name: str + :return: ContainerAppsBuildResource or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.ContainerAppsBuildResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ContainerAppsBuildResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + build_name=build_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ContainerAppsBuildResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _delete_initial( + self, resource_group_name: str, container_app_name: str, build_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + build_name=build_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, container_app_name: str, build_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a Container Apps Build resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App the Build is associated. Required. + :type container_app_name: str + :param build_name: The name of a build. Required. + :type build_name: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + build_name=build_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_diagnostics_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_diagnostics_operations.py index 19d52da603ad..5da3148ed0d5 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 @@ -5,10 +5,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from collections.abc import MutableMapping from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,6 +27,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ..._serialization import Deserializer, Serializer from ...operations._container_apps_diagnostics_operations import ( build_get_detector_request, build_get_revision_request, @@ -33,11 +35,8 @@ build_list_detectors_request, build_list_revisions_request, ) +from .._configuration import ContainerAppsAPIClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,10 +55,10 @@ class ContainerAppsDiagnosticsOperations: 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") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerAppsAPIClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list_detectors( diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_label_history_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_label_history_operations.py new file mode 100644 index 000000000000..7f13c5058fa0 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_label_history_operations.py @@ -0,0 +1,270 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 collections.abc import MutableMapping +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse + +from azure.core import AsyncPipelineClient +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._serialization import Deserializer, Serializer +from ...operations._container_apps_label_history_operations import ( + build_delete_label_history_request, + build_get_label_history_request, + build_list_label_history_request, +) +from .._configuration import ContainerAppsAPIClientConfiguration + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ContainerAppsLabelHistoryOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.aio.ContainerAppsAPIClient`'s + :attr:`container_apps_label_history` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerAppsAPIClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_label_history( + self, resource_group_name: str, container_app_name: str, filter: Optional[str] = None, **kwargs: Any + ) -> AsyncIterable["_models.LabelHistory"]: + """Get the Label History for a given Container App. + + Get the Label History for a given Container App. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param filter: The filter to apply on the operation. Default value is None. + :type filter: str + :return: An iterator like instance of either LabelHistory or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.LabelHistory] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.LabelHistoryCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_label_history_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + subscription_id=self._config.subscription_id, + filter=filter, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("LabelHistoryCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get_label_history( + self, resource_group_name: str, container_app_name: str, label_name: str, **kwargs: Any + ) -> _models.LabelHistory: + """Get the history of a label. + + Get the history of a label. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param label_name: Name of the Container App label. Required. + :type label_name: str + :return: LabelHistory or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.LabelHistory + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.LabelHistory] = kwargs.pop("cls", None) + + _request = build_get_label_history_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + label_name=label_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("LabelHistory", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete_label_history( + self, resource_group_name: str, container_app_name: str, label_name: str, **kwargs: Any + ) -> None: + """Delete the history of a label. + + Delete the history of a label. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param label_name: Name of the Container App label. Required. + :type label_name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 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_label_history_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + label_name=label_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_operations.py index 2e0e7384646e..a0b32c497aaa 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,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -32,6 +33,7 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models +from ..._serialization import Deserializer, Serializer from ...operations._container_apps_operations import ( build_create_or_update_request, build_delete_request, @@ -45,11 +47,8 @@ build_stop_request, build_update_request, ) +from .._configuration import ContainerAppsAPIClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -68,10 +67,10 @@ class ContainerAppsOperations: 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") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerAppsAPIClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.ContainerApp"]: diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_patches_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_patches_operations.py new file mode 100644 index 000000000000..2119afb0f720 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_patches_operations.py @@ -0,0 +1,662 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 collections.abc import MutableMapping +from io import IOBase +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core import AsyncPipelineClient +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._serialization import Deserializer, Serializer +from ...operations._container_apps_patches_operations import ( + build_apply_request, + build_delete_request, + build_get_request, + build_list_by_container_app_request, + build_skip_configure_request, +) +from .._configuration import ContainerAppsAPIClientConfiguration + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ContainerAppsPatchesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.aio.ContainerAppsAPIClient`'s + :attr:`container_apps_patches` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerAppsAPIClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_container_app( + self, resource_group_name: str, container_app_name: str, filter: Optional[str] = None, **kwargs: Any + ) -> AsyncIterable["_models.ContainerAppsPatchResource"]: + """List Container Apps Patch resources by ContainerApp. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App the Patch is associated. Required. + :type container_app_name: str + :param filter: The filter to apply on the operation. For example, + $filter=properties/patchApplyStatus eq 'Succeeded'. Default value is None. + :type filter: str + :return: An iterator like instance of either ContainerAppsPatchResource or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.ContainerAppsPatchResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.PatchCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_container_app_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + subscription_id=self._config.subscription_id, + filter=filter, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("PatchCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get( + self, resource_group_name: str, container_app_name: str, patch_name: str, **kwargs: Any + ) -> _models.ContainerAppsPatchResource: + """Get details for specific Container Apps Patch by patch name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App the Patch is associated. Required. + :type container_app_name: str + :param patch_name: The name of the patch. Required. + :type patch_name: str + :return: ContainerAppsPatchResource or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.ContainerAppsPatchResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ContainerAppsPatchResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + patch_name=patch_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ContainerAppsPatchResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _delete_initial( + self, resource_group_name: str, container_app_name: str, patch_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + patch_name=patch_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, container_app_name: str, patch_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete specific Container Apps Patch by patch name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App the Patch is associated. Required. + :type container_app_name: str + :param patch_name: The name of the patch. Required. + :type patch_name: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + patch_name=patch_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _skip_configure_initial( + self, + resource_group_name: str, + container_app_name: str, + patch_name: str, + patch_skip_config: Union[_models.PatchSkipConfig, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(patch_skip_config, (IOBase, bytes)): + _content = patch_skip_config + else: + _json = self._serialize.body(patch_skip_config, "PatchSkipConfig") + + _request = build_skip_configure_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + patch_name=patch_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_skip_configure( + self, + resource_group_name: str, + container_app_name: str, + patch_name: str, + patch_skip_config: _models.PatchSkipConfig, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Configure the Container Apps Patch skip option by patch name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App the Patch is associated. Required. + :type container_app_name: str + :param patch_name: The name of the patch. Required. + :type patch_name: str + :param patch_skip_config: Configure patcher to skip a patch or not. Required. + :type patch_skip_config: ~azure.mgmt.appcontainers.models.PatchSkipConfig + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_skip_configure( + self, + resource_group_name: str, + container_app_name: str, + patch_name: str, + patch_skip_config: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Configure the Container Apps Patch skip option by patch name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App the Patch is associated. Required. + :type container_app_name: str + :param patch_name: The name of the patch. Required. + :type patch_name: str + :param patch_skip_config: Configure patcher to skip a patch or not. Required. + :type patch_skip_config: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_skip_configure( + self, + resource_group_name: str, + container_app_name: str, + patch_name: str, + patch_skip_config: Union[_models.PatchSkipConfig, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Configure the Container Apps Patch skip option by patch name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App the Patch is associated. Required. + :type container_app_name: str + :param patch_name: The name of the patch. Required. + :type patch_name: str + :param patch_skip_config: Configure patcher to skip a patch or not. Is either a PatchSkipConfig + type or a IO[bytes] type. Required. + :type patch_skip_config: ~azure.mgmt.appcontainers.models.PatchSkipConfig or IO[bytes] + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._skip_configure_initial( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + patch_name=patch_name, + patch_skip_config=patch_skip_config, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _apply_initial( + self, resource_group_name: str, container_app_name: str, patch_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_apply_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + patch_name=patch_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_apply( + self, resource_group_name: str, container_app_name: str, patch_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.ContainerAppsPatchResource]: + """Apply a Container Apps Patch resource with patch name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App the Patch is associated. Required. + :type container_app_name: str + :param patch_name: The name of the patch. Required. + :type patch_name: str + :return: An instance of AsyncLROPoller that returns either ContainerAppsPatchResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.ContainerAppsPatchResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ContainerAppsPatchResource] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._apply_initial( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + patch_name=patch_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ContainerAppsPatchResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.ContainerAppsPatchResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ContainerAppsPatchResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_revision_replicas_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_revision_replicas_operations.py index f125dc0bd967..28b50194143a 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 @@ -5,9 +5,10 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from collections.abc import MutableMapping from typing import Any, Callable, Dict, Optional, TypeVar +from azure.core import AsyncPipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -23,15 +24,13 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ..._serialization import Deserializer, Serializer from ...operations._container_apps_revision_replicas_operations import ( build_get_replica_request, build_list_replicas_request, ) +from .._configuration import ContainerAppsAPIClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -50,10 +49,10 @@ class ContainerAppsRevisionReplicasOperations: 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") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerAppsAPIClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async async def get_replica( 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 94d47e0249fd..389f9aa692d2 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 @@ -5,10 +5,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from collections.abc import MutableMapping from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,6 +27,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ..._serialization import Deserializer, Serializer from ...operations._container_apps_revisions_operations import ( build_activate_revision_request, build_deactivate_revision_request, @@ -33,11 +35,8 @@ build_list_revisions_request, build_restart_revision_request, ) +from .._configuration import ContainerAppsAPIClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,10 +55,10 @@ class ContainerAppsRevisionsOperations: 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") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerAppsAPIClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list_revisions( diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_session_pools_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_session_pools_operations.py index 59f58167896d..0efa9ee59073 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_session_pools_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_session_pools_operations.py @@ -5,11 +5,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -31,6 +32,7 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models +from ..._serialization import Deserializer, Serializer from ...operations._container_apps_session_pools_operations import ( build_create_or_update_request, build_delete_request, @@ -39,11 +41,8 @@ build_list_by_subscription_request, build_update_request, ) +from .._configuration import ContainerAppsAPIClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -62,10 +61,10 @@ class ContainerAppsSessionPoolsOperations: 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") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerAppsAPIClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.SessionPool"]: 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 4c3ace040618..334c6d7d5a0a 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 @@ -5,11 +5,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -31,17 +32,15 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models +from ..._serialization import Deserializer, Serializer from ...operations._container_apps_source_controls_operations import ( build_create_or_update_request, build_delete_request, build_get_request, build_list_by_container_app_request, ) +from .._configuration import ContainerAppsAPIClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -60,10 +59,10 @@ class ContainerAppsSourceControlsOperations: 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") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerAppsAPIClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list_by_container_app( @@ -220,6 +219,7 @@ async def _create_or_update_initial( container_app_name: str, source_control_name: str, source_control_envelope: Union[_models.SourceControl, IO[bytes]], + x_ms_github_auxiliary: Optional[str] = None, **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -250,6 +250,7 @@ async def _create_or_update_initial( container_app_name=container_app_name, source_control_name=source_control_name, subscription_id=self._config.subscription_id, + x_ms_github_auxiliary=x_ms_github_auxiliary, api_version=api_version, content_type=content_type, json=_json, @@ -290,6 +291,7 @@ async def begin_create_or_update( container_app_name: str, source_control_name: str, source_control_envelope: _models.SourceControl, + x_ms_github_auxiliary: Optional[str] = None, *, content_type: str = "application/json", **kwargs: Any @@ -308,6 +310,9 @@ async def begin_create_or_update( :param source_control_envelope: Properties used to create a Container App SourceControl. Required. :type source_control_envelope: ~azure.mgmt.appcontainers.models.SourceControl + :param x_ms_github_auxiliary: Github personal access token used for SourceControl. Default + value is None. + :type x_ms_github_auxiliary: str :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -324,6 +329,7 @@ async def begin_create_or_update( container_app_name: str, source_control_name: str, source_control_envelope: IO[bytes], + x_ms_github_auxiliary: Optional[str] = None, *, content_type: str = "application/json", **kwargs: Any @@ -342,6 +348,9 @@ async def begin_create_or_update( :param source_control_envelope: Properties used to create a Container App SourceControl. Required. :type source_control_envelope: IO[bytes] + :param x_ms_github_auxiliary: Github personal access token used for SourceControl. Default + value is None. + :type x_ms_github_auxiliary: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -358,6 +367,7 @@ async def begin_create_or_update( container_app_name: str, source_control_name: str, source_control_envelope: Union[_models.SourceControl, IO[bytes]], + x_ms_github_auxiliary: Optional[str] = None, **kwargs: Any ) -> AsyncLROPoller[_models.SourceControl]: """Create or update the SourceControl for a Container App. @@ -374,6 +384,9 @@ async def begin_create_or_update( :param source_control_envelope: Properties used to create a Container App SourceControl. Is either a SourceControl type or a IO[bytes] type. Required. :type source_control_envelope: ~azure.mgmt.appcontainers.models.SourceControl or IO[bytes] + :param x_ms_github_auxiliary: Github personal access token used for SourceControl. Default + value is None. + :type x_ms_github_auxiliary: str :return: An instance of AsyncLROPoller that returns either SourceControl or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.SourceControl] @@ -394,6 +407,7 @@ async def begin_create_or_update( container_app_name=container_app_name, source_control_name=source_control_name, source_control_envelope=source_control_envelope, + x_ms_github_auxiliary=x_ms_github_auxiliary, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -428,7 +442,14 @@ def get_long_running_output(pipeline_response): ) async def _delete_initial( - self, resource_group_name: str, container_app_name: str, source_control_name: str, **kwargs: Any + self, + resource_group_name: str, + container_app_name: str, + source_control_name: str, + x_ms_github_auxiliary: Optional[str] = None, + ignore_workflow_deletion_failure: Optional[bool] = None, + delete_workflow: Optional[bool] = None, + **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -449,6 +470,9 @@ async def _delete_initial( container_app_name=container_app_name, source_control_name=source_control_name, subscription_id=self._config.subscription_id, + x_ms_github_auxiliary=x_ms_github_auxiliary, + ignore_workflow_deletion_failure=ignore_workflow_deletion_failure, + delete_workflow=delete_workflow, api_version=api_version, headers=_headers, params=_params, @@ -481,7 +505,14 @@ async def _delete_initial( @distributed_trace_async async def begin_delete( - self, resource_group_name: str, container_app_name: str, source_control_name: str, **kwargs: Any + self, + resource_group_name: str, + container_app_name: str, + source_control_name: str, + x_ms_github_auxiliary: Optional[str] = None, + ignore_workflow_deletion_failure: Optional[bool] = None, + delete_workflow: Optional[bool] = None, + **kwargs: Any ) -> AsyncLROPoller[None]: """Delete a Container App SourceControl. @@ -494,6 +525,14 @@ async def begin_delete( :type container_app_name: str :param source_control_name: Name of the Container App SourceControl. Required. :type source_control_name: str + :param x_ms_github_auxiliary: Github personal access token used for SourceControl. Default + value is None. + :type x_ms_github_auxiliary: str + :param ignore_workflow_deletion_failure: Ignore Workflow Deletion Failure. Default value is + None. + :type ignore_workflow_deletion_failure: bool + :param delete_workflow: Delete workflow. Default value is None. + :type delete_workflow: bool :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -511,6 +550,9 @@ async def begin_delete( resource_group_name=resource_group_name, container_app_name=container_app_name, source_control_name=source_control_name, + x_ms_github_auxiliary=x_ms_github_auxiliary, + ignore_workflow_deletion_failure=ignore_workflow_deletion_failure, + delete_workflow=delete_workflow, api_version=api_version, cls=lambda x, y, z: x, headers=_headers, diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_dapr_component_resiliency_policies_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_dapr_component_resiliency_policies_operations.py new file mode 100644 index 000000000000..622812ee4ec4 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_dapr_component_resiliency_policies_operations.py @@ -0,0 +1,442 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 collections.abc import MutableMapping +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core import AsyncPipelineClient +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._serialization import Deserializer, Serializer +from ...operations._dapr_component_resiliency_policies_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, +) +from .._configuration import ContainerAppsAPIClientConfiguration + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class DaprComponentResiliencyPoliciesOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.aio.ContainerAppsAPIClient`'s + :attr:`dapr_component_resiliency_policies` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerAppsAPIClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, resource_group_name: str, environment_name: str, component_name: str, **kwargs: Any + ) -> AsyncIterable["_models.DaprComponentResiliencyPolicy"]: + """Get the resiliency policies for a Dapr component. + + Get the resiliency policies for a Dapr component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param component_name: Name of the Dapr Component. Required. + :type component_name: str + :return: An iterator like instance of either DaprComponentResiliencyPolicy or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicy] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DaprComponentResiliencyPoliciesCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + component_name=component_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("DaprComponentResiliencyPoliciesCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get( + self, resource_group_name: str, environment_name: str, component_name: str, name: str, **kwargs: Any + ) -> _models.DaprComponentResiliencyPolicy: + """Get a Dapr component resiliency policy. + + Get a Dapr component resiliency policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param component_name: Name of the Dapr Component. Required. + :type component_name: str + :param name: Name of the Dapr Component Resiliency Policy. Required. + :type name: str + :return: DaprComponentResiliencyPolicy or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DaprComponentResiliencyPolicy] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + component_name=component_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("DaprComponentResiliencyPolicy", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def create_or_update( + self, + resource_group_name: str, + environment_name: str, + component_name: str, + name: str, + dapr_component_resiliency_policy_envelope: _models.DaprComponentResiliencyPolicy, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DaprComponentResiliencyPolicy: + """Creates or updates a Dapr component resiliency policy. + + Creates or updates a resiliency policy for a Dapr component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param component_name: Name of the Dapr Component. Required. + :type component_name: str + :param name: Name of the Dapr Component Resiliency Policy. Required. + :type name: str + :param dapr_component_resiliency_policy_envelope: Configuration details of the Dapr Component + Resiliency Policy. Required. + :type dapr_component_resiliency_policy_envelope: + ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicy + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: DaprComponentResiliencyPolicy or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + environment_name: str, + component_name: str, + name: str, + dapr_component_resiliency_policy_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DaprComponentResiliencyPolicy: + """Creates or updates a Dapr component resiliency policy. + + Creates or updates a resiliency policy for a Dapr component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param component_name: Name of the Dapr Component. Required. + :type component_name: str + :param name: Name of the Dapr Component Resiliency Policy. Required. + :type name: str + :param dapr_component_resiliency_policy_envelope: Configuration details of the Dapr Component + Resiliency Policy. Required. + :type dapr_component_resiliency_policy_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: DaprComponentResiliencyPolicy or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + environment_name: str, + component_name: str, + name: str, + dapr_component_resiliency_policy_envelope: Union[_models.DaprComponentResiliencyPolicy, IO[bytes]], + **kwargs: Any + ) -> _models.DaprComponentResiliencyPolicy: + """Creates or updates a Dapr component resiliency policy. + + Creates or updates a resiliency policy for a Dapr component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param component_name: Name of the Dapr Component. Required. + :type component_name: str + :param name: Name of the Dapr Component Resiliency Policy. Required. + :type name: str + :param dapr_component_resiliency_policy_envelope: Configuration details of the Dapr Component + Resiliency Policy. Is either a DaprComponentResiliencyPolicy type or a IO[bytes] type. + Required. + :type dapr_component_resiliency_policy_envelope: + ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicy or IO[bytes] + :return: DaprComponentResiliencyPolicy or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DaprComponentResiliencyPolicy] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(dapr_component_resiliency_policy_envelope, (IOBase, bytes)): + _content = dapr_component_resiliency_policy_envelope + else: + _json = self._serialize.body(dapr_component_resiliency_policy_envelope, "DaprComponentResiliencyPolicy") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + component_name=component_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("DaprComponentResiliencyPolicy", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete( + self, resource_group_name: str, environment_name: str, component_name: str, name: str, **kwargs: Any + ) -> None: + """Delete a Dapr component resiliency policy. + + Delete a resiliency policy for a Dapr component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param component_name: Name of the Dapr Component. Required. + :type component_name: str + :param name: Name of the Dapr Component Resiliency Policy. Required. + :type name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + component_name=component_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_dapr_components_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_dapr_components_operations.py index fb9eb23bfe25..059698d668ec 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 @@ -5,11 +5,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +28,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ..._serialization import Deserializer, Serializer from ...operations._dapr_components_operations import ( build_create_or_update_request, build_delete_request, @@ -34,11 +36,8 @@ build_list_request, build_list_secrets_request, ) +from .._configuration import ContainerAppsAPIClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -57,10 +56,10 @@ class DaprComponentsOperations: 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") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerAppsAPIClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list( diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_dapr_subscriptions_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_dapr_subscriptions_operations.py new file mode 100644 index 000000000000..cbc353b48e0b --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_dapr_subscriptions_operations.py @@ -0,0 +1,416 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 collections.abc import MutableMapping +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core import AsyncPipelineClient +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._serialization import Deserializer, Serializer +from ...operations._dapr_subscriptions_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, +) +from .._configuration import ContainerAppsAPIClientConfiguration + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class DaprSubscriptionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.aio.ContainerAppsAPIClient`'s + :attr:`dapr_subscriptions` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerAppsAPIClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, resource_group_name: str, environment_name: str, **kwargs: Any + ) -> AsyncIterable["_models.DaprSubscription"]: + """Get the Dapr subscriptions for a managed environment. + + Get the Dapr subscriptions for a managed environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :return: An iterator like instance of either DaprSubscription or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.DaprSubscription] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DaprSubscriptionsCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("DaprSubscriptionsCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get( + self, resource_group_name: str, environment_name: str, name: str, **kwargs: Any + ) -> _models.DaprSubscription: + """Get a dapr subscription. + + Get a dapr subscription. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the Dapr subscription. Required. + :type name: str + :return: DaprSubscription or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.DaprSubscription + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DaprSubscription] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("DaprSubscription", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def create_or_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + dapr_subscription_envelope: _models.DaprSubscription, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DaprSubscription: + """Creates or updates a Dapr subscription. + + Creates or updates a Dapr subscription in a Managed Environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the Dapr subscription. Required. + :type name: str + :param dapr_subscription_envelope: Configuration details of the Dapr subscription. Required. + :type dapr_subscription_envelope: ~azure.mgmt.appcontainers.models.DaprSubscription + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: DaprSubscription or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.DaprSubscription + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + dapr_subscription_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DaprSubscription: + """Creates or updates a Dapr subscription. + + Creates or updates a Dapr subscription in a Managed Environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the Dapr subscription. Required. + :type name: str + :param dapr_subscription_envelope: Configuration details of the Dapr subscription. Required. + :type dapr_subscription_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: DaprSubscription or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.DaprSubscription + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + dapr_subscription_envelope: Union[_models.DaprSubscription, IO[bytes]], + **kwargs: Any + ) -> _models.DaprSubscription: + """Creates or updates a Dapr subscription. + + Creates or updates a Dapr subscription in a Managed Environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the Dapr subscription. Required. + :type name: str + :param dapr_subscription_envelope: Configuration details of the Dapr subscription. Is either a + DaprSubscription type or a IO[bytes] type. Required. + :type dapr_subscription_envelope: ~azure.mgmt.appcontainers.models.DaprSubscription or + IO[bytes] + :return: DaprSubscription or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.DaprSubscription + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DaprSubscription] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(dapr_subscription_envelope, (IOBase, bytes)): + _content = dapr_subscription_envelope + else: + _json = self._serialize.body(dapr_subscription_envelope, "DaprSubscription") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("DaprSubscription", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete(self, resource_group_name: str, environment_name: str, name: str, **kwargs: Any) -> None: + """Delete a Dapr subscription. + + Delete a Dapr subscription from a Managed Environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the Dapr subscription. Required. + :type name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_dot_net_components_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_dot_net_components_operations.py new file mode 100644 index 000000000000..e00915704abb --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_dot_net_components_operations.py @@ -0,0 +1,763 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 collections.abc import MutableMapping +from io import IOBase +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core import AsyncPipelineClient +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._serialization import Deserializer, Serializer +from ...operations._dot_net_components_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, + build_update_request, +) +from .._configuration import ContainerAppsAPIClientConfiguration + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class DotNetComponentsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.aio.ContainerAppsAPIClient`'s + :attr:`dot_net_components` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerAppsAPIClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, resource_group_name: str, environment_name: str, **kwargs: Any + ) -> AsyncIterable["_models.DotNetComponent"]: + """Get the .NET Components for a managed environment. + + Get the .NET Components for a managed environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :return: An iterator like instance of either DotNetComponent or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.DotNetComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DotNetComponentsCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("DotNetComponentsCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get( + self, resource_group_name: str, environment_name: str, name: str, **kwargs: Any + ) -> _models.DotNetComponent: + """Get a .NET Component. + + Get a .NET Component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the .NET Component. Required. + :type name: str + :return: DotNetComponent or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.DotNetComponent + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DotNetComponent] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("DotNetComponent", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + environment_name: str, + name: str, + dot_net_component_envelope: Union[_models.DotNetComponent, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(dot_net_component_envelope, (IOBase, bytes)): + _content = dot_net_component_envelope + else: + _json = self._serialize.body(dot_net_component_envelope, "DotNetComponent") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + dot_net_component_envelope: _models.DotNetComponent, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.DotNetComponent]: + """Creates or updates a .NET Component. + + Creates or updates a .NET Component in a Managed Environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the .NET Component. Required. + :type name: str + :param dot_net_component_envelope: Configuration details of the .NET Component. Required. + :type dot_net_component_envelope: ~azure.mgmt.appcontainers.models.DotNetComponent + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either DotNetComponent or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.DotNetComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + dot_net_component_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.DotNetComponent]: + """Creates or updates a .NET Component. + + Creates or updates a .NET Component in a Managed Environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the .NET Component. Required. + :type name: str + :param dot_net_component_envelope: Configuration details of the .NET Component. Required. + :type dot_net_component_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either DotNetComponent or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.DotNetComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + dot_net_component_envelope: Union[_models.DotNetComponent, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.DotNetComponent]: + """Creates or updates a .NET Component. + + Creates or updates a .NET Component in a Managed Environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the .NET Component. Required. + :type name: str + :param dot_net_component_envelope: Configuration details of the .NET Component. Is either a + DotNetComponent type or a IO[bytes] type. Required. + :type dot_net_component_envelope: ~azure.mgmt.appcontainers.models.DotNetComponent or IO[bytes] + :return: An instance of AsyncLROPoller that returns either DotNetComponent or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.DotNetComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DotNetComponent] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + dot_net_component_envelope=dot_net_component_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("DotNetComponent", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.DotNetComponent].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.DotNetComponent]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _update_initial( + self, + resource_group_name: str, + environment_name: str, + name: str, + dot_net_component_envelope: Union[_models.DotNetComponent, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(dot_net_component_envelope, (IOBase, bytes)): + _content = dot_net_component_envelope + else: + _json = self._serialize.body(dot_net_component_envelope, "DotNetComponent") + + _request = build_update_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + dot_net_component_envelope: _models.DotNetComponent, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.DotNetComponent]: + """Update properties of a .NET Component. + + Patches a .NET Component using JSON Merge Patch. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the .NET Component. Required. + :type name: str + :param dot_net_component_envelope: Configuration details of the .NET Component. Required. + :type dot_net_component_envelope: ~azure.mgmt.appcontainers.models.DotNetComponent + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either DotNetComponent or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.DotNetComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + dot_net_component_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.DotNetComponent]: + """Update properties of a .NET Component. + + Patches a .NET Component using JSON Merge Patch. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the .NET Component. Required. + :type name: str + :param dot_net_component_envelope: Configuration details of the .NET Component. Required. + :type dot_net_component_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either DotNetComponent or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.DotNetComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + dot_net_component_envelope: Union[_models.DotNetComponent, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.DotNetComponent]: + """Update properties of a .NET Component. + + Patches a .NET Component using JSON Merge Patch. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the .NET Component. Required. + :type name: str + :param dot_net_component_envelope: Configuration details of the .NET Component. Is either a + DotNetComponent type or a IO[bytes] type. Required. + :type dot_net_component_envelope: ~azure.mgmt.appcontainers.models.DotNetComponent or IO[bytes] + :return: An instance of AsyncLROPoller that returns either DotNetComponent or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.DotNetComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DotNetComponent] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + dot_net_component_envelope=dot_net_component_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("DotNetComponent", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.DotNetComponent].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.DotNetComponent]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, resource_group_name: str, environment_name: str, name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, environment_name: str, name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a .NET Component. + + Delete a .NET Component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the .NET Component. Required. + :type name: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_functions_extension_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_functions_extension_operations.py new file mode 100644 index 000000000000..c536ac0f8e38 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_functions_extension_operations.py @@ -0,0 +1,123 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 collections.abc import MutableMapping +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core import AsyncPipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._serialization import Deserializer, Serializer +from ...operations._functions_extension_operations import build_invoke_functions_host_request +from .._configuration import ContainerAppsAPIClientConfiguration + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class FunctionsExtensionOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.aio.ContainerAppsAPIClient`'s + :attr:`functions_extension` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerAppsAPIClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def invoke_functions_host( + self, + resource_group_name: str, + container_app_name: str, + revision_name: str, + function_app_name: str, + **kwargs: Any + ) -> str: + """Proxies a Functions host call to the function app backed by the container app. + + Proxies a Functions host call to the function app backed by the container app. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param revision_name: Name of the Container App Revision, the parent resource. Required. + :type revision_name: str + :param function_app_name: Name of the Function App, the extension resource. Required. + :type function_app_name: str + :return: str or the result of cls(response) + :rtype: str + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[str] = kwargs.pop("cls", None) + + _request = build_invoke_functions_host_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + revision_name=revision_name, + function_app_name=function_app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("str", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_http_route_config_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_http_route_config_operations.py new file mode 100644 index 000000000000..c17b12714635 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_http_route_config_operations.py @@ -0,0 +1,572 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 collections.abc import MutableMapping +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core import AsyncPipelineClient +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._serialization import Deserializer, Serializer +from ...operations._http_route_config_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, + build_update_request, +) +from .._configuration import ContainerAppsAPIClientConfiguration + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class HttpRouteConfigOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.aio.ContainerAppsAPIClient`'s + :attr:`http_route_config` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerAppsAPIClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, resource_group_name: str, environment_name: str, http_route_name: str, **kwargs: Any + ) -> _models.HttpRouteConfig: + """Get the specified Managed Http Route Config. + + Get the specified Managed Http Route Config. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param http_route_name: Name of the Http Route Config Resource. Required. + :type http_route_name: str + :return: HttpRouteConfig or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.HttpRouteConfig + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.HttpRouteConfig] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + http_route_name=http_route_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("HttpRouteConfig", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def create_or_update( + self, + resource_group_name: str, + environment_name: str, + http_route_name: str, + http_route_config_envelope: Optional[_models.HttpRouteConfig] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.HttpRouteConfig: + """Create or Update a Http Route Config. + + Create or Update a Http Route Config. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param http_route_name: Name of the Http Route Config Resource. Required. + :type http_route_name: str + :param http_route_config_envelope: Http Route config to be created or updated. Default value is + None. + :type http_route_config_envelope: ~azure.mgmt.appcontainers.models.HttpRouteConfig + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: HttpRouteConfig or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.HttpRouteConfig + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + environment_name: str, + http_route_name: str, + http_route_config_envelope: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.HttpRouteConfig: + """Create or Update a Http Route Config. + + Create or Update a Http Route Config. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param http_route_name: Name of the Http Route Config Resource. Required. + :type http_route_name: str + :param http_route_config_envelope: Http Route config to be created or updated. Default value is + None. + :type http_route_config_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: HttpRouteConfig or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.HttpRouteConfig + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + environment_name: str, + http_route_name: str, + http_route_config_envelope: Optional[Union[_models.HttpRouteConfig, IO[bytes]]] = None, + **kwargs: Any + ) -> _models.HttpRouteConfig: + """Create or Update a Http Route Config. + + Create or Update a Http Route Config. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param http_route_name: Name of the Http Route Config Resource. Required. + :type http_route_name: str + :param http_route_config_envelope: Http Route config to be created or updated. Is either a + HttpRouteConfig type or a IO[bytes] type. Default value is None. + :type http_route_config_envelope: ~azure.mgmt.appcontainers.models.HttpRouteConfig or IO[bytes] + :return: HttpRouteConfig or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.HttpRouteConfig + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.HttpRouteConfig] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(http_route_config_envelope, (IOBase, bytes)): + _content = http_route_config_envelope + else: + if http_route_config_envelope is not None: + _json = self._serialize.body(http_route_config_envelope, "HttpRouteConfig") + else: + _json = None + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + http_route_name=http_route_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("HttpRouteConfig", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def update( + self, + resource_group_name: str, + environment_name: str, + http_route_name: str, + http_route_config_envelope: _models.HttpRouteConfig, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.HttpRouteConfig: + """Update tags of a manged http route object. + + Patches an http route config resource. Only patching of tags is supported. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param http_route_name: Name of the Http Route Config Resource. Required. + :type http_route_name: str + :param http_route_config_envelope: Properties of http route config that need to be updated. + Required. + :type http_route_config_envelope: ~azure.mgmt.appcontainers.models.HttpRouteConfig + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: HttpRouteConfig or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.HttpRouteConfig + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + environment_name: str, + http_route_name: str, + http_route_config_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.HttpRouteConfig: + """Update tags of a manged http route object. + + Patches an http route config resource. Only patching of tags is supported. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param http_route_name: Name of the Http Route Config Resource. Required. + :type http_route_name: str + :param http_route_config_envelope: Properties of http route config that need to be updated. + Required. + :type http_route_config_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: HttpRouteConfig or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.HttpRouteConfig + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + environment_name: str, + http_route_name: str, + http_route_config_envelope: Union[_models.HttpRouteConfig, IO[bytes]], + **kwargs: Any + ) -> _models.HttpRouteConfig: + """Update tags of a manged http route object. + + Patches an http route config resource. Only patching of tags is supported. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param http_route_name: Name of the Http Route Config Resource. Required. + :type http_route_name: str + :param http_route_config_envelope: Properties of http route config that need to be updated. Is + either a HttpRouteConfig type or a IO[bytes] type. Required. + :type http_route_config_envelope: ~azure.mgmt.appcontainers.models.HttpRouteConfig or IO[bytes] + :return: HttpRouteConfig or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.HttpRouteConfig + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.HttpRouteConfig] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(http_route_config_envelope, (IOBase, bytes)): + _content = http_route_config_envelope + else: + _json = self._serialize.body(http_route_config_envelope, "HttpRouteConfig") + + _request = build_update_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + http_route_name=http_route_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("HttpRouteConfig", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete( + self, resource_group_name: str, environment_name: str, http_route_name: str, **kwargs: Any + ) -> None: + """Deletes the specified Managed Http Route. + + Deletes the specified Managed Http Route. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param http_route_name: Name of the Http Route Config Resource. Required. + :type http_route_name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + http_route_name=http_route_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list( + self, resource_group_name: str, environment_name: str, **kwargs: Any + ) -> AsyncIterable["_models.HttpRouteConfig"]: + """Get the Managed Http Routes in a given managed environment. + + Get the Managed Http Routes in a given managed environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :return: An iterator like instance of either HttpRouteConfig or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.HttpRouteConfig] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.HttpRouteConfigCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("HttpRouteConfigCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_java_components_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_java_components_operations.py index a4ba90b9d8de..5cf8e8afc0b1 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_java_components_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_java_components_operations.py @@ -5,11 +5,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -31,6 +32,7 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models +from ..._serialization import Deserializer, Serializer from ...operations._java_components_operations import ( build_create_or_update_request, build_delete_request, @@ -38,11 +40,8 @@ build_list_request, build_update_request, ) +from .._configuration import ContainerAppsAPIClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -61,10 +60,10 @@ class JavaComponentsOperations: 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") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerAppsAPIClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list( @@ -704,7 +703,7 @@ async def _delete_initial( async def begin_delete( self, resource_group_name: str, environment_name: str, name: str, **kwargs: Any ) -> AsyncLROPoller[None]: - """Delete. + """Delete a Java Component. Delete a Java Component. 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 1a470d10420f..a153bdf235e1 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 @@ -5,10 +5,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from collections.abc import MutableMapping from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -25,12 +26,10 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ..._serialization import Deserializer, Serializer from ...operations._jobs_executions_operations import build_list_request +from .._configuration import ContainerAppsAPIClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -49,10 +48,10 @@ class JobsExecutionsOperations: 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") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerAppsAPIClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list( 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 91d654e8f638..72a75833f054 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,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -32,6 +33,7 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models +from ..._serialization import Deserializer, Serializer from ...operations._jobs_operations import ( build_create_or_update_request, build_delete_request, @@ -42,21 +44,20 @@ build_list_detectors_request, build_list_secrets_request, build_proxy_get_request, + build_resume_request, build_start_request, build_stop_execution_request, build_stop_multiple_executions_request, + build_suspend_request, build_update_request, ) +from .._configuration import ContainerAppsAPIClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class JobsOperations: +class JobsOperations: # pylint: disable=too-many-public-methods """ .. warning:: **DO NOT** instantiate this class directly. @@ -70,10 +71,10 @@ class JobsOperations: 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") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerAppsAPIClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list_detectors( @@ -226,7 +227,7 @@ async def get_detector( @distributed_trace_async async def proxy_get(self, resource_group_name: str, job_name: str, api_name: str, **kwargs: Any) -> _models.Job: - """Get the properties of a Container App Job. + """Get the properties for a given Container App Job. Get the properties of a Container App Job. @@ -1507,3 +1508,241 @@ async def list_secrets( return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore + + async def _resume_initial(self, resource_group_name: str, job_name: str, **kwargs: Any) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_resume_request( + resource_group_name=resource_group_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_resume(self, resource_group_name: str, job_name: str, **kwargs: Any) -> AsyncLROPoller[_models.Job]: + """Resumes a suspended job. + + Resumes a suspended job. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param job_name: Name of the Job. Required. + :type job_name: str + :return: An instance of AsyncLROPoller that returns either Job or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.Job] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Job] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._resume_initial( + resource_group_name=resource_group_name, + job_name=job_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Job", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.Job].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.Job]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _suspend_initial(self, resource_group_name: str, job_name: str, **kwargs: Any) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_suspend_request( + resource_group_name=resource_group_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_suspend( + self, resource_group_name: str, job_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.Job]: + """Suspends a job. + + Suspends a job. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param job_name: Name of the Job. Required. + :type job_name: str + :return: An instance of AsyncLROPoller that returns either Job or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.Job] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Job] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._suspend_initial( + resource_group_name=resource_group_name, + job_name=job_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Job", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.Job].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.Job]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_logic_apps_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_logic_apps_operations.py new file mode 100644 index 000000000000..b3c4c8a4bfed --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_logic_apps_operations.py @@ -0,0 +1,765 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 collections.abc import MutableMapping +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core import AsyncPipelineClient +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._serialization import Deserializer, Serializer +from ...operations._logic_apps_operations import ( + build_create_or_update_request, + build_delete_request, + build_deploy_workflow_artifacts_request, + build_get_request, + build_get_workflow_request, + build_invoke_request, + build_list_workflows_connections_request, + build_list_workflows_request, +) +from .._configuration import ContainerAppsAPIClientConfiguration + +JSON = MutableMapping[str, Any] +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class LogicAppsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.aio.ContainerAppsAPIClient`'s + :attr:`logic_apps` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerAppsAPIClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, resource_group_name: str, container_app_name: str, logic_app_name: str, **kwargs: Any + ) -> _models.LogicApp: + """Gets a logic app extension resource. + + Gets a logic app extension resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param logic_app_name: Name of the Logic App, the extension resource. Required. + :type logic_app_name: str + :return: LogicApp or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.LogicApp + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.LogicApp] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + logic_app_name=logic_app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("LogicApp", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def create_or_update( + self, + resource_group_name: str, + container_app_name: str, + logic_app_name: str, + resource: _models.LogicApp, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.LogicApp: + """Create or update a Logic App extension resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param logic_app_name: Name of the Logic App, the extension resource. Required. + :type logic_app_name: str + :param resource: Logic app resource properties. Required. + :type resource: ~azure.mgmt.appcontainers.models.LogicApp + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: LogicApp or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.LogicApp + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + container_app_name: str, + logic_app_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.LogicApp: + """Create or update a Logic App extension resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param logic_app_name: Name of the Logic App, the extension resource. Required. + :type logic_app_name: str + :param resource: Logic app resource properties. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: LogicApp or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.LogicApp + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + container_app_name: str, + logic_app_name: str, + resource: Union[_models.LogicApp, IO[bytes]], + **kwargs: Any + ) -> _models.LogicApp: + """Create or update a Logic App extension resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param logic_app_name: Name of the Logic App, the extension resource. Required. + :type logic_app_name: str + :param resource: Logic app resource properties. Is either a LogicApp type or a IO[bytes] type. + Required. + :type resource: ~azure.mgmt.appcontainers.models.LogicApp or IO[bytes] + :return: LogicApp or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.LogicApp + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.LogicApp] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "LogicApp") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + logic_app_name=logic_app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("LogicApp", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete( + self, resource_group_name: str, container_app_name: str, logic_app_name: str, **kwargs: Any + ) -> None: + """Deletes a Logic App extension resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param logic_app_name: Name of the Logic App, the extension resource. Required. + :type logic_app_name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + logic_app_name=logic_app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list_workflows( + self, resource_group_name: str, container_app_name: str, logic_app_name: str, **kwargs: Any + ) -> AsyncIterable["_models.WorkflowEnvelope"]: + """List the workflows for a logic app. + + List the workflows for a logic app. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param logic_app_name: Name of the Logic App, the extension resource. Required. + :type logic_app_name: str + :return: An iterator like instance of either WorkflowEnvelope or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.WorkflowEnvelope] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.WorkflowEnvelopeCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_workflows_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + logic_app_name=logic_app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("WorkflowEnvelopeCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get_workflow( + self, resource_group_name: str, container_app_name: str, logic_app_name: str, workflow_name: str, **kwargs: Any + ) -> _models.WorkflowEnvelope: + """Get workflow information by its name. + + Get workflow information by its name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param logic_app_name: Name of the Logic App, the extension resource. Required. + :type logic_app_name: str + :param workflow_name: Workflow name. Required. + :type workflow_name: str + :return: WorkflowEnvelope or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.WorkflowEnvelope + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.WorkflowEnvelope] = kwargs.pop("cls", None) + + _request = build_get_workflow_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + logic_app_name=logic_app_name, + workflow_name=workflow_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("WorkflowEnvelope", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def deploy_workflow_artifacts( + self, + resource_group_name: str, + container_app_name: str, + logic_app_name: str, + workflow_artifacts: Optional[_models.WorkflowArtifacts] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Creates or updates the artifacts for the logic app. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param logic_app_name: Name of the Logic App, the extension resource. Required. + :type logic_app_name: str + :param workflow_artifacts: Application settings and files of the workflow. Default value is + None. + :type workflow_artifacts: ~azure.mgmt.appcontainers.models.WorkflowArtifacts + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def deploy_workflow_artifacts( + self, + resource_group_name: str, + container_app_name: str, + logic_app_name: str, + workflow_artifacts: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Creates or updates the artifacts for the logic app. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param logic_app_name: Name of the Logic App, the extension resource. Required. + :type logic_app_name: str + :param workflow_artifacts: Application settings and files of the workflow. Default value is + None. + :type workflow_artifacts: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def deploy_workflow_artifacts( + self, + resource_group_name: str, + container_app_name: str, + logic_app_name: str, + workflow_artifacts: Optional[Union[_models.WorkflowArtifacts, IO[bytes]]] = None, + **kwargs: Any + ) -> None: + """Creates or updates the artifacts for the logic app. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param logic_app_name: Name of the Logic App, the extension resource. Required. + :type logic_app_name: str + :param workflow_artifacts: Application settings and files of the workflow. Is either a + WorkflowArtifacts type or a IO[bytes] type. Default value is None. + :type workflow_artifacts: ~azure.mgmt.appcontainers.models.WorkflowArtifacts or IO[bytes] + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(workflow_artifacts, (IOBase, bytes)): + _content = workflow_artifacts + else: + if workflow_artifacts is not None: + _json = self._serialize.body(workflow_artifacts, "WorkflowArtifacts") + else: + _json = None + + _request = build_deploy_workflow_artifacts_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + logic_app_name=logic_app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace_async + async def list_workflows_connections( + self, resource_group_name: str, container_app_name: str, logic_app_name: str, **kwargs: Any + ) -> _models.WorkflowEnvelope: + """Gets logic app's connections. + + Gets logic app's connections. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param logic_app_name: Name of the Logic App, the extension resource. Required. + :type logic_app_name: str + :return: WorkflowEnvelope or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.WorkflowEnvelope + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.WorkflowEnvelope] = kwargs.pop("cls", None) + + _request = build_list_workflows_connections_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + logic_app_name=logic_app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("WorkflowEnvelope", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def invoke( + self, + resource_group_name: str, + container_app_name: str, + logic_app_name: str, + x_ms_logic_apps_proxy_path: str, + x_ms_logic_apps_proxy_method: Union[str, _models.LogicAppsProxyMethod], + **kwargs: Any + ) -> JSON: + """Proxies a the API call to the logic app backed by the container app. + + Proxies a the API call to the logic app backed by the container app. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param logic_app_name: Name of the LogicApp App, the extension resource. Required. + :type logic_app_name: str + :param x_ms_logic_apps_proxy_path: The proxy path for the API call. Required. + :type x_ms_logic_apps_proxy_path: str + :param x_ms_logic_apps_proxy_method: The proxy method for the API call. Known values are: "GET" + and "POST". Required. + :type x_ms_logic_apps_proxy_method: str or + ~azure.mgmt.appcontainers.models.LogicAppsProxyMethod + :return: JSON or the result of cls(response) + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[JSON] = kwargs.pop("cls", None) + + _request = build_invoke_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + logic_app_name=logic_app_name, + subscription_id=self._config.subscription_id, + x_ms_logic_apps_proxy_path=x_ms_logic_apps_proxy_path, + x_ms_logic_apps_proxy_method=x_ms_logic_apps_proxy_method, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("object", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_maintenance_configurations_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_maintenance_configurations_operations.py new file mode 100644 index 000000000000..1bac7f56ea65 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_maintenance_configurations_operations.py @@ -0,0 +1,409 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 collections.abc import MutableMapping +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core import AsyncPipelineClient +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._serialization import Deserializer, Serializer +from ...operations._maintenance_configurations_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, +) +from .._configuration import ContainerAppsAPIClientConfiguration + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class MaintenanceConfigurationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.aio.ContainerAppsAPIClient`'s + :attr:`maintenance_configurations` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerAppsAPIClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, resource_group_name: str, environment_name: str, **kwargs: Any + ) -> AsyncIterable["_models.MaintenanceConfigurationResource"]: + """Gets all maintenance configurations in the specified Managed Environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: The name of the Managed Environment. Required. + :type environment_name: str + :return: An iterator like instance of either MaintenanceConfigurationResource or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.MaintenanceConfigurationResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.MaintenanceConfigurationCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("MaintenanceConfigurationCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @overload + async def create_or_update( + self, + resource_group_name: str, + environment_name: str, + config_name: str, + maintenance_configuration_envelope: _models.MaintenanceConfigurationResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MaintenanceConfigurationResource: + """Create or update the maintenance configuration for Managed Environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: The name of the Managed Environment. Required. + :type environment_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param maintenance_configuration_envelope: Parameters to set the maintenance configuration for + ManagedEnvironment . Required. + :type maintenance_configuration_envelope: + ~azure.mgmt.appcontainers.models.MaintenanceConfigurationResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: MaintenanceConfigurationResource or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.MaintenanceConfigurationResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + environment_name: str, + config_name: str, + maintenance_configuration_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MaintenanceConfigurationResource: + """Create or update the maintenance configuration for Managed Environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: The name of the Managed Environment. Required. + :type environment_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param maintenance_configuration_envelope: Parameters to set the maintenance configuration for + ManagedEnvironment . Required. + :type maintenance_configuration_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: MaintenanceConfigurationResource or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.MaintenanceConfigurationResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + environment_name: str, + config_name: str, + maintenance_configuration_envelope: Union[_models.MaintenanceConfigurationResource, IO[bytes]], + **kwargs: Any + ) -> _models.MaintenanceConfigurationResource: + """Create or update the maintenance configuration for Managed Environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: The name of the Managed Environment. Required. + :type environment_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param maintenance_configuration_envelope: Parameters to set the maintenance configuration for + ManagedEnvironment . Is either a MaintenanceConfigurationResource type or a IO[bytes] type. + Required. + :type maintenance_configuration_envelope: + ~azure.mgmt.appcontainers.models.MaintenanceConfigurationResource or IO[bytes] + :return: MaintenanceConfigurationResource or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.MaintenanceConfigurationResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.MaintenanceConfigurationResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(maintenance_configuration_envelope, (IOBase, bytes)): + _content = maintenance_configuration_envelope + else: + _json = self._serialize.body(maintenance_configuration_envelope, "MaintenanceConfigurationResource") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + config_name=config_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("MaintenanceConfigurationResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete(self, resource_group_name: str, environment_name: str, config_name: str, **kwargs: Any) -> None: + """Deletes the maintenance configuration of a ManagedEnvironment . + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: The name of the Managed Environment. Required. + :type environment_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + config_name=config_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace_async + async def get( + self, resource_group_name: str, environment_name: str, config_name: str, **kwargs: Any + ) -> _models.MaintenanceConfigurationResource: + """Gets the maintenance configuration of a ManagedEnvironment . + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: The name of the Managed Environment. Required. + :type environment_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :return: MaintenanceConfigurationResource or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.MaintenanceConfigurationResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.MaintenanceConfigurationResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + config_name=config_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("MaintenanceConfigurationResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_certificates_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_certificates_operations.py index 091b88359471..a2dd9f82fdd2 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 @@ -5,11 +5,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -31,6 +32,7 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models +from ..._serialization import Deserializer, Serializer from ...operations._managed_certificates_operations import ( build_create_or_update_request, build_delete_request, @@ -38,11 +40,8 @@ build_list_request, build_update_request, ) +from .._configuration import ContainerAppsAPIClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -61,10 +60,10 @@ class ManagedCertificatesOperations: 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") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerAppsAPIClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async async def get( 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 2d141c684651..940117c9a9c7 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 @@ -5,9 +5,10 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from collections.abc import MutableMapping from typing import Any, Callable, Dict, Optional, TypeVar +from azure.core import AsyncPipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -23,15 +24,13 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ..._serialization import Deserializer, Serializer from ...operations._managed_environment_diagnostics_operations import ( build_get_detector_request, build_list_detectors_request, ) +from .._configuration import ContainerAppsAPIClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -50,10 +49,10 @@ class ManagedEnvironmentDiagnosticsOperations: 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") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerAppsAPIClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async async def list_detectors( diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environment_private_endpoint_connections_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environment_private_endpoint_connections_operations.py new file mode 100644 index 000000000000..7c6e9f849404 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environment_private_endpoint_connections_operations.py @@ -0,0 +1,555 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 collections.abc import MutableMapping +from io import IOBase +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core import AsyncPipelineClient +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._serialization import Deserializer, Serializer +from ...operations._managed_environment_private_endpoint_connections_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, +) +from .._configuration import ContainerAppsAPIClientConfiguration + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ManagedEnvironmentPrivateEndpointConnectionsOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.aio.ContainerAppsAPIClient`'s + :attr:`managed_environment_private_endpoint_connections` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerAppsAPIClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, resource_group_name: str, environment_name: str, **kwargs: Any + ) -> AsyncIterable["_models.PrivateEndpointConnection"]: + """List private endpoint connections for a given managed environment. + + List private endpoint connections for a given managed environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :return: An iterator like instance of either PrivateEndpointConnection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get( + self, resource_group_name: str, environment_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Get a private endpoint connection for a given managed environment. + + Get a private endpoint connection for a given managed environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. Required. + :type private_endpoint_connection_name: str + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + environment_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection_envelope: Union[_models.PrivateEndpointConnection, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(private_endpoint_connection_envelope, (IOBase, bytes)): + _content = private_endpoint_connection_envelope + else: + _json = self._serialize.body(private_endpoint_connection_envelope, "PrivateEndpointConnection") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + environment_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection_envelope: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PrivateEndpointConnection]: + """Update the state of a private endpoint connection for a given managed environment. + + Update the state of a private endpoint connection for a given managed environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. Required. + :type private_endpoint_connection_name: str + :param private_endpoint_connection_envelope: The resource of private endpoint and its + properties. Required. + :type private_endpoint_connection_envelope: + ~azure.mgmt.appcontainers.models.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + environment_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PrivateEndpointConnection]: + """Update the state of a private endpoint connection for a given managed environment. + + Update the state of a private endpoint connection for a given managed environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. Required. + :type private_endpoint_connection_name: str + :param private_endpoint_connection_envelope: The resource of private endpoint and its + properties. Required. + :type private_endpoint_connection_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + environment_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection_envelope: Union[_models.PrivateEndpointConnection, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.PrivateEndpointConnection]: + """Update the state of a private endpoint connection for a given managed environment. + + Update the state of a private endpoint connection for a given managed environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. Required. + :type private_endpoint_connection_name: str + :param private_endpoint_connection_envelope: The resource of private endpoint and its + properties. Is either a PrivateEndpointConnection type or a IO[bytes] type. Required. + :type private_endpoint_connection_envelope: + ~azure.mgmt.appcontainers.models.PrivateEndpointConnection or IO[bytes] + :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + environment_name=environment_name, + private_endpoint_connection_name=private_endpoint_connection_name, + private_endpoint_connection_envelope=private_endpoint_connection_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.PrivateEndpointConnection].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.PrivateEndpointConnection]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, resource_group_name: str, environment_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, environment_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a private endpoint connection for a given managed environment. + + Delete a private endpoint connection for a given managed environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. Required. + :type private_endpoint_connection_name: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + environment_name=environment_name, + private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environment_private_link_resources_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environment_private_link_resources_operations.py new file mode 100644 index 000000000000..960f46e141d2 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environment_private_link_resources_operations.py @@ -0,0 +1,141 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from collections.abc import MutableMapping +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse + +from azure.core import AsyncPipelineClient +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._serialization import Deserializer, Serializer +from ...operations._managed_environment_private_link_resources_operations import build_list_request +from .._configuration import ContainerAppsAPIClientConfiguration + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ManagedEnvironmentPrivateLinkResourcesOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.aio.ContainerAppsAPIClient`'s + :attr:`managed_environment_private_link_resources` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerAppsAPIClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, resource_group_name: str, environment_name: str, **kwargs: Any + ) -> AsyncIterable["_models.PrivateLinkResource"]: + """List private link resources for a given managed environment. + + List private link resources for a given managed environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :return: An iterator like instance of either PrivateLinkResource or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.PrivateLinkResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environment_usages_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environment_usages_operations.py index dd057f307cb5..9d03e5c2a899 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environment_usages_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environment_usages_operations.py @@ -5,10 +5,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from collections.abc import MutableMapping from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -25,12 +26,10 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ..._serialization import Deserializer, Serializer from ...operations._managed_environment_usages_operations import build_list_request +from .._configuration import ContainerAppsAPIClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -49,10 +48,10 @@ class ManagedEnvironmentUsagesOperations: 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") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerAppsAPIClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list(self, resource_group_name: str, environment_name: str, **kwargs: Any) -> AsyncIterable["_models.Usage"]: 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 2c65cd16f2ee..b4691bd3b482 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 @@ -5,9 +5,10 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from collections.abc import MutableMapping from typing import Any, Callable, Dict, Optional, TypeVar +from azure.core import AsyncPipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -23,12 +24,10 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ..._serialization import Deserializer, Serializer from ...operations._managed_environments_diagnostics_operations import build_get_root_request +from .._configuration import ContainerAppsAPIClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -47,10 +46,10 @@ class ManagedEnvironmentsDiagnosticsOperations: 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") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerAppsAPIClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async async def get_root( 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 4f500a905537..772962abd4db 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 @@ -5,11 +5,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -31,6 +32,7 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models +from ..._serialization import Deserializer, Serializer from ...operations._managed_environments_operations import ( build_create_or_update_request, build_delete_request, @@ -41,11 +43,8 @@ build_list_workload_profile_states_request, build_update_request, ) +from .._configuration import ContainerAppsAPIClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,10 +63,10 @@ class ManagedEnvironmentsOperations: 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") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerAppsAPIClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.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 b64970565bf2..8bc25311b3d3 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 @@ -5,10 +5,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from azure.core import AsyncPipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -24,17 +25,15 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ..._serialization import Deserializer, Serializer from ...operations._managed_environments_storages_operations import ( build_create_or_update_request, build_delete_request, build_get_request, build_list_request, ) +from .._configuration import ContainerAppsAPIClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -53,10 +52,10 @@ class ManagedEnvironmentsStoragesOperations: 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") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerAppsAPIClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async async def list( @@ -316,7 +315,7 @@ async def create_or_update( response = pipeline_response.http_response - if response.status_code not in [200]: + 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) 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 208dcdec4cdf..e4ed779cdb76 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 @@ -5,10 +5,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from azure.core import AsyncPipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -24,12 +25,10 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ..._serialization import Deserializer, Serializer from ...operations._namespaces_operations import build_check_name_availability_request +from .._configuration import ContainerAppsAPIClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -48,10 +47,10 @@ class NamespacesOperations: 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") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerAppsAPIClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @overload async def check_name_availability( 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 3c05cd264bb5..4cf7d28b5550 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 @@ -5,10 +5,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from collections.abc import MutableMapping from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -25,12 +26,10 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ..._serialization import Deserializer, Serializer from ...operations._operations import build_list_request +from .._configuration import ContainerAppsAPIClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -49,10 +48,10 @@ class Operations: 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") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerAppsAPIClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.OperationDetail"]: diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_usages_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_usages_operations.py index 7e8582d07d35..fcec40feb41a 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_usages_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_usages_operations.py @@ -5,10 +5,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from collections.abc import MutableMapping from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -25,12 +26,10 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ..._serialization import Deserializer, Serializer from ...operations._usages_operations import build_list_request +from .._configuration import ContainerAppsAPIClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -49,10 +48,10 @@ class UsagesOperations: 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") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerAppsAPIClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list(self, location: str, **kwargs: Any) -> AsyncIterable["_models.Usage"]: 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 48ac3d754b24..e27074dd3fb8 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 @@ -16,8 +16,11 @@ from ._models_py3 import ( # type: ignore AllowedAudiencesValidation, AllowedPrincipals, + AppInsightsConfiguration, AppLogsConfiguration, AppRegistration, + AppResiliency, + AppResiliencyCollection, Apple, AppleRegistration, AuthConfig, @@ -40,6 +43,13 @@ BillingMeterCollection, BillingMeterProperties, BlobStorageTokenStore, + BuildCollection, + BuildConfiguration, + BuildResource, + BuildToken, + BuilderCollection, + BuilderResource, + BuilderResourceUpdate, Certificate, CertificateCollection, CertificateKeyVaultProperties, @@ -47,10 +57,15 @@ CertificateProperties, CheckNameAvailabilityRequest, CheckNameAvailabilityResponse, + CircuitBreakerPolicy, ClientRegistration, Configuration, ConnectedEnvironment, ConnectedEnvironmentCollection, + ConnectedEnvironmentDaprComponent, + ConnectedEnvironmentDaprComponentProperties, + ConnectedEnvironmentDaprComponentsCollection, + ConnectedEnvironmentPatchResource, ConnectedEnvironmentStorage, ConnectedEnvironmentStorageProperties, ConnectedEnvironmentStoragesCollection, @@ -63,7 +78,15 @@ ContainerAppProbeHttpGet, ContainerAppProbeHttpGetHttpHeadersItem, ContainerAppProbeTcpSocket, + ContainerAppPropertiesPatchingConfiguration, ContainerAppSecret, + ContainerAppsBuildCollection, + ContainerAppsBuildConfiguration, + ContainerAppsBuildResource, + ContainerAppsPatchResource, + ContainerExecutionStatus, + ContainerRegistry, + ContainerRegistryWithCustomImage, ContainerResources, CookieExpiration, CorsPolicy, @@ -76,16 +99,34 @@ CustomOpenIdConnectProvider, CustomScaleRule, Dapr, + DaprAppHealth, DaprComponent, + DaprComponentProperties, + DaprComponentResiliencyPoliciesCollection, + DaprComponentResiliencyPolicy, + DaprComponentResiliencyPolicyCircuitBreakerPolicyConfiguration, + DaprComponentResiliencyPolicyConfiguration, + DaprComponentResiliencyPolicyHttpRetryBackOffConfiguration, + DaprComponentResiliencyPolicyHttpRetryPolicyConfiguration, + DaprComponentResiliencyPolicyTimeoutPolicyConfiguration, + DaprComponentServiceBinding, DaprComponentsCollection, DaprConfiguration, DaprMetadata, DaprSecret, DaprSecretsCollection, + DaprServiceBindMetadata, + DaprSubscription, + DaprSubscriptionBulkSubscribeOptions, + DaprSubscriptionRouteRule, + DaprSubscriptionRoutes, + DaprSubscriptionsCollection, + DataDogConfiguration, DefaultAuthorizationPolicy, DefaultErrorResponse, DefaultErrorResponseError, DefaultErrorResponseErrorDetailsItem, + DestinationsConfiguration, DiagnosticDataProviderMetadata, DiagnosticDataProviderMetadataPropertyBagItem, DiagnosticDataTableResponseColumn, @@ -98,13 +139,20 @@ DiagnosticsDefinition, DiagnosticsProperties, DiagnosticsStatus, + DotNetComponent, + DotNetComponentConfigurationProperty, + DotNetComponentServiceBind, + DotNetComponentsCollection, DynamicPoolConfiguration, EncryptionSettings, EnvironmentAuthToken, EnvironmentVar, + EnvironmentVariable, ErrorAdditionalInfo, ErrorDetail, + ErrorEntity, ErrorResponse, + ExecutionStatus, ExtendedLocation, Facebook, ForwardProxy, @@ -112,12 +160,28 @@ GithubActionConfiguration, GlobalValidation, Google, + Header, + HeaderMatch, + HttpConnectionPool, + HttpGet, + HttpRetryPolicy, + HttpRoute, + HttpRouteAction, + HttpRouteConfig, + HttpRouteConfigCollection, + HttpRouteConfigProperties, + HttpRouteMatch, + HttpRouteProvisioningErrors, + HttpRouteRule, + HttpRouteTarget, HttpScaleRule, HttpSettings, HttpSettingsRoutes, IdentityProviders, IdentitySettings, Ingress, + IngressConfiguration, + IngressConfigurationScale, IngressPortMapping, IngressStickySessions, InitContainer, @@ -148,12 +212,21 @@ JobsCollection, JwtClaimChecks, KedaConfiguration, + LabelHistory, + LabelHistoryCollection, + LabelHistoryProperties, + LabelHistoryRecordItem, LifecycleConfiguration, ListUsagesResult, LogAnalyticsConfiguration, + LoggerSetting, + LogicApp, Login, LoginRoutes, LoginScopes, + LogsConfiguration, + MaintenanceConfigurationCollection, + MaintenanceConfigurationResource, ManagedCertificate, ManagedCertificateCollection, ManagedCertificatePatch, @@ -168,15 +241,32 @@ ManagedEnvironmentsCollection, ManagedIdentitySetting, ManagedServiceIdentity, + MetricsConfiguration, Mtls, + NacosComponent, NfsAzureFileProperties, Nonce, OpenIdConnectClientCredential, OpenIdConnectConfig, OpenIdConnectLogin, OpenIdConnectRegistration, + OpenTelemetryConfiguration, OperationDetail, OperationDisplay, + OtlpConfiguration, + PatchCollection, + PatchDetails, + PatchDetailsNewLayer, + PatchDetailsOldLayer, + PatchProperties, + PatchSkipConfig, + PreBuildStep, + PrivateEndpoint, + PrivateEndpointConnection, + PrivateEndpointConnectionListResult, + PrivateLinkResource, + PrivateLinkResourceListResult, + PrivateLinkServiceConnectionState, ProxyResource, QueueScaleRule, RegistryCredentials, @@ -184,16 +274,24 @@ Replica, ReplicaCollection, ReplicaContainer, + ReplicaExecutionStatus, Resource, + ResourceTags, Revision, RevisionCollection, Runtime, + RuntimeDotnet, RuntimeJava, + RuntimeJavaAgent, + RuntimeJavaAgentLogging, Scale, ScaleConfiguration, ScaleRule, ScaleRuleAuth, + ScgRoute, + ScheduledEntry, Secret, + SecretKeyVaultProperties, SecretVolumeItem, SecretsCollection, Service, @@ -206,16 +304,26 @@ SessionPoolCollection, SessionPoolSecret, SessionPoolUpdatableProperties, + SessionProbe, + SessionProbeHttpGet, + SessionProbeHttpGetHttpHeadersItem, + SessionProbeTcpSocket, SessionRegistryCredentials, + SmbStorage, SourceControl, SourceControlCollection, SpringBootAdminComponent, SpringCloudConfigComponent, SpringCloudEurekaComponent, + SpringCloudGatewayComponent, SystemData, + TcpConnectionPool, + TcpRetryPolicy, TcpScaleRule, Template, + TimeoutPolicy, TokenStore, + TracesConfiguration, TrackedResource, TrafficWeight, Twitter, @@ -226,6 +334,11 @@ VnetConfiguration, Volume, VolumeMount, + WorkflowArtifacts, + WorkflowEnvelope, + WorkflowEnvelopeCollection, + WorkflowEnvelopeProperties, + WorkflowHealth, WorkloadProfile, WorkloadProfileStates, WorkloadProfileStatesCollection, @@ -240,9 +353,15 @@ AppProtocol, Applicability, BindingType, + BuildProvisioningState, + BuildStatus, + BuilderProvisioningState, CertificateProvisioningState, + CertificateType, CheckNameAvailabilityReason, + ConnectedEnvironmentDaprComponentProvisioningState, ConnectedEnvironmentProvisioningState, + ConnectedEnvironmentStorageProvisioningState, ContainerAppContainerRunningState, ContainerAppProvisioningState, ContainerAppReplicaRunningState, @@ -250,33 +369,54 @@ ContainerType, CookieExpirationConvention, CreatedByType, + DetectionStatus, DnsVerificationTestResult, + DotNetComponentProvisioningState, + DotNetComponentType, EnvironmentProvisioningState, ExtendedLocationTypes, ForwardProxyConvention, + HttpRouteProvisioningState, IdentitySettingsLifeCycle, + ImageType, IngressClientCertificateMode, + IngressTargetPortHttpScheme, IngressTransportMethod, JavaComponentProvisioningState, JavaComponentType, JobExecutionRunningState, JobProvisioningState, + JobRunningState, + Kind, + Level, LifecycleType, LogLevel, + LogicAppsProxyMethod, ManagedCertificateDomainControlValidation, ManagedServiceIdentityType, + PatchApplyStatus, + PatchType, + PatchingMode, PoolManagementType, + PrivateEndpointConnectionProvisioningState, + PrivateEndpointServiceConnectionStatus, + PublicNetworkAccess, RevisionHealthState, RevisionProvisioningState, RevisionRunningState, Scheme, SessionNetworkStatus, SessionPoolProvisioningState, + SessionProbeType, SourceControlOperationState, + Status, StorageType, TriggerType, Type, UnauthenticatedClientActionV2, + WeekDay, + WorkflowHealthState, + WorkflowState, ) from ._patch import __all__ as _patch_all from ._patch import * @@ -285,8 +425,11 @@ __all__ = [ "AllowedAudiencesValidation", "AllowedPrincipals", + "AppInsightsConfiguration", "AppLogsConfiguration", "AppRegistration", + "AppResiliency", + "AppResiliencyCollection", "Apple", "AppleRegistration", "AuthConfig", @@ -309,6 +452,13 @@ "BillingMeterCollection", "BillingMeterProperties", "BlobStorageTokenStore", + "BuildCollection", + "BuildConfiguration", + "BuildResource", + "BuildToken", + "BuilderCollection", + "BuilderResource", + "BuilderResourceUpdate", "Certificate", "CertificateCollection", "CertificateKeyVaultProperties", @@ -316,10 +466,15 @@ "CertificateProperties", "CheckNameAvailabilityRequest", "CheckNameAvailabilityResponse", + "CircuitBreakerPolicy", "ClientRegistration", "Configuration", "ConnectedEnvironment", "ConnectedEnvironmentCollection", + "ConnectedEnvironmentDaprComponent", + "ConnectedEnvironmentDaprComponentProperties", + "ConnectedEnvironmentDaprComponentsCollection", + "ConnectedEnvironmentPatchResource", "ConnectedEnvironmentStorage", "ConnectedEnvironmentStorageProperties", "ConnectedEnvironmentStoragesCollection", @@ -332,7 +487,15 @@ "ContainerAppProbeHttpGet", "ContainerAppProbeHttpGetHttpHeadersItem", "ContainerAppProbeTcpSocket", + "ContainerAppPropertiesPatchingConfiguration", "ContainerAppSecret", + "ContainerAppsBuildCollection", + "ContainerAppsBuildConfiguration", + "ContainerAppsBuildResource", + "ContainerAppsPatchResource", + "ContainerExecutionStatus", + "ContainerRegistry", + "ContainerRegistryWithCustomImage", "ContainerResources", "CookieExpiration", "CorsPolicy", @@ -345,16 +508,34 @@ "CustomOpenIdConnectProvider", "CustomScaleRule", "Dapr", + "DaprAppHealth", "DaprComponent", + "DaprComponentProperties", + "DaprComponentResiliencyPoliciesCollection", + "DaprComponentResiliencyPolicy", + "DaprComponentResiliencyPolicyCircuitBreakerPolicyConfiguration", + "DaprComponentResiliencyPolicyConfiguration", + "DaprComponentResiliencyPolicyHttpRetryBackOffConfiguration", + "DaprComponentResiliencyPolicyHttpRetryPolicyConfiguration", + "DaprComponentResiliencyPolicyTimeoutPolicyConfiguration", + "DaprComponentServiceBinding", "DaprComponentsCollection", "DaprConfiguration", "DaprMetadata", "DaprSecret", "DaprSecretsCollection", + "DaprServiceBindMetadata", + "DaprSubscription", + "DaprSubscriptionBulkSubscribeOptions", + "DaprSubscriptionRouteRule", + "DaprSubscriptionRoutes", + "DaprSubscriptionsCollection", + "DataDogConfiguration", "DefaultAuthorizationPolicy", "DefaultErrorResponse", "DefaultErrorResponseError", "DefaultErrorResponseErrorDetailsItem", + "DestinationsConfiguration", "DiagnosticDataProviderMetadata", "DiagnosticDataProviderMetadataPropertyBagItem", "DiagnosticDataTableResponseColumn", @@ -367,13 +548,20 @@ "DiagnosticsDefinition", "DiagnosticsProperties", "DiagnosticsStatus", + "DotNetComponent", + "DotNetComponentConfigurationProperty", + "DotNetComponentServiceBind", + "DotNetComponentsCollection", "DynamicPoolConfiguration", "EncryptionSettings", "EnvironmentAuthToken", "EnvironmentVar", + "EnvironmentVariable", "ErrorAdditionalInfo", "ErrorDetail", + "ErrorEntity", "ErrorResponse", + "ExecutionStatus", "ExtendedLocation", "Facebook", "ForwardProxy", @@ -381,12 +569,28 @@ "GithubActionConfiguration", "GlobalValidation", "Google", + "Header", + "HeaderMatch", + "HttpConnectionPool", + "HttpGet", + "HttpRetryPolicy", + "HttpRoute", + "HttpRouteAction", + "HttpRouteConfig", + "HttpRouteConfigCollection", + "HttpRouteConfigProperties", + "HttpRouteMatch", + "HttpRouteProvisioningErrors", + "HttpRouteRule", + "HttpRouteTarget", "HttpScaleRule", "HttpSettings", "HttpSettingsRoutes", "IdentityProviders", "IdentitySettings", "Ingress", + "IngressConfiguration", + "IngressConfigurationScale", "IngressPortMapping", "IngressStickySessions", "InitContainer", @@ -417,12 +621,21 @@ "JobsCollection", "JwtClaimChecks", "KedaConfiguration", + "LabelHistory", + "LabelHistoryCollection", + "LabelHistoryProperties", + "LabelHistoryRecordItem", "LifecycleConfiguration", "ListUsagesResult", "LogAnalyticsConfiguration", + "LoggerSetting", + "LogicApp", "Login", "LoginRoutes", "LoginScopes", + "LogsConfiguration", + "MaintenanceConfigurationCollection", + "MaintenanceConfigurationResource", "ManagedCertificate", "ManagedCertificateCollection", "ManagedCertificatePatch", @@ -437,15 +650,32 @@ "ManagedEnvironmentsCollection", "ManagedIdentitySetting", "ManagedServiceIdentity", + "MetricsConfiguration", "Mtls", + "NacosComponent", "NfsAzureFileProperties", "Nonce", "OpenIdConnectClientCredential", "OpenIdConnectConfig", "OpenIdConnectLogin", "OpenIdConnectRegistration", + "OpenTelemetryConfiguration", "OperationDetail", "OperationDisplay", + "OtlpConfiguration", + "PatchCollection", + "PatchDetails", + "PatchDetailsNewLayer", + "PatchDetailsOldLayer", + "PatchProperties", + "PatchSkipConfig", + "PreBuildStep", + "PrivateEndpoint", + "PrivateEndpointConnection", + "PrivateEndpointConnectionListResult", + "PrivateLinkResource", + "PrivateLinkResourceListResult", + "PrivateLinkServiceConnectionState", "ProxyResource", "QueueScaleRule", "RegistryCredentials", @@ -453,16 +683,24 @@ "Replica", "ReplicaCollection", "ReplicaContainer", + "ReplicaExecutionStatus", "Resource", + "ResourceTags", "Revision", "RevisionCollection", "Runtime", + "RuntimeDotnet", "RuntimeJava", + "RuntimeJavaAgent", + "RuntimeJavaAgentLogging", "Scale", "ScaleConfiguration", "ScaleRule", "ScaleRuleAuth", + "ScgRoute", + "ScheduledEntry", "Secret", + "SecretKeyVaultProperties", "SecretVolumeItem", "SecretsCollection", "Service", @@ -475,16 +713,26 @@ "SessionPoolCollection", "SessionPoolSecret", "SessionPoolUpdatableProperties", + "SessionProbe", + "SessionProbeHttpGet", + "SessionProbeHttpGetHttpHeadersItem", + "SessionProbeTcpSocket", "SessionRegistryCredentials", + "SmbStorage", "SourceControl", "SourceControlCollection", "SpringBootAdminComponent", "SpringCloudConfigComponent", "SpringCloudEurekaComponent", + "SpringCloudGatewayComponent", "SystemData", + "TcpConnectionPool", + "TcpRetryPolicy", "TcpScaleRule", "Template", + "TimeoutPolicy", "TokenStore", + "TracesConfiguration", "TrackedResource", "TrafficWeight", "Twitter", @@ -495,6 +743,11 @@ "VnetConfiguration", "Volume", "VolumeMount", + "WorkflowArtifacts", + "WorkflowEnvelope", + "WorkflowEnvelopeCollection", + "WorkflowEnvelopeProperties", + "WorkflowHealth", "WorkloadProfile", "WorkloadProfileStates", "WorkloadProfileStatesCollection", @@ -506,9 +759,15 @@ "AppProtocol", "Applicability", "BindingType", + "BuildProvisioningState", + "BuildStatus", + "BuilderProvisioningState", "CertificateProvisioningState", + "CertificateType", "CheckNameAvailabilityReason", + "ConnectedEnvironmentDaprComponentProvisioningState", "ConnectedEnvironmentProvisioningState", + "ConnectedEnvironmentStorageProvisioningState", "ContainerAppContainerRunningState", "ContainerAppProvisioningState", "ContainerAppReplicaRunningState", @@ -516,33 +775,54 @@ "ContainerType", "CookieExpirationConvention", "CreatedByType", + "DetectionStatus", "DnsVerificationTestResult", + "DotNetComponentProvisioningState", + "DotNetComponentType", "EnvironmentProvisioningState", "ExtendedLocationTypes", "ForwardProxyConvention", + "HttpRouteProvisioningState", "IdentitySettingsLifeCycle", + "ImageType", "IngressClientCertificateMode", + "IngressTargetPortHttpScheme", "IngressTransportMethod", "JavaComponentProvisioningState", "JavaComponentType", "JobExecutionRunningState", "JobProvisioningState", + "JobRunningState", + "Kind", + "Level", "LifecycleType", "LogLevel", + "LogicAppsProxyMethod", "ManagedCertificateDomainControlValidation", "ManagedServiceIdentityType", + "PatchApplyStatus", + "PatchType", + "PatchingMode", "PoolManagementType", + "PrivateEndpointConnectionProvisioningState", + "PrivateEndpointServiceConnectionStatus", + "PublicNetworkAccess", "RevisionHealthState", "RevisionProvisioningState", "RevisionRunningState", "Scheme", "SessionNetworkStatus", "SessionPoolProvisioningState", + "SessionProbeType", "SourceControlOperationState", + "Status", "StorageType", "TriggerType", "Type", "UnauthenticatedClientActionV2", + "WeekDay", + "WorkflowHealthState", + "WorkflowState", ] __all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/models/_container_apps_api_client_enums.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/models/_container_apps_api_client_enums.py index 9f7903a8773d..04b36a6125ea 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/models/_container_apps_api_client_enums.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/models/_container_apps_api_client_enums.py @@ -32,13 +32,15 @@ class ActiveRevisionsMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): .. raw:: html - Multiple: multiple revisions can be active.Single: Only one - revision can be active at a time. Revision weights can not be used in this mode. If no value if - provided, this is the default.. + Single: Only one revision can be active at a time. Traffic weights cannot be + used. This is the default.Multiple: Multiple revisions can be active, including + optional traffic weights and labels.Labels: Only revisions with labels are active. + Traffic weights can be applied to labels.. """ MULTIPLE = "Multiple" SINGLE = "Single" + LABELS = "Labels" class Affinity(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -69,6 +71,39 @@ class BindingType(str, Enum, metaclass=CaseInsensitiveEnumMeta): DISABLED = "Disabled" SNI_ENABLED = "SniEnabled" + AUTO = "Auto" + + +class BuilderProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Resource instance provisioning state.""" + + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CANCELED = "Canceled" + CREATING = "Creating" + UPDATING = "Updating" + DELETING = "Deleting" + + +class BuildProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Resource instance provisioning state.""" + + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CANCELED = "Canceled" + CREATING = "Creating" + UPDATING = "Updating" + DELETING = "Deleting" + + +class BuildStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Status of the build once it has been provisioned.""" + + NOT_STARTED = "NotStarted" + IN_PROGRESS = "InProgress" + SUCCEEDED = "Succeeded" + CANCELED = "Canceled" + FAILED = "Failed" class CertificateProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -79,6 +114,16 @@ class CertificateProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta) CANCELED = "Canceled" DELETE_FAILED = "DeleteFailed" PENDING = "Pending" + DELETING = "Deleting" + + +class CertificateType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of the certificate. Allowed values are ``ServerSSLCertificate`` and + ``ImagePullTrustedCA``. + """ + + SERVER_SSL_CERTIFICATE = "ServerSSLCertificate" + IMAGE_PULL_TRUSTED_CA = "ImagePullTrustedCA" class CheckNameAvailabilityReason(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -88,6 +133,16 @@ class CheckNameAvailabilityReason(str, Enum, metaclass=CaseInsensitiveEnumMeta): ALREADY_EXISTS = "AlreadyExists" +class ConnectedEnvironmentDaprComponentProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Provisioning state of the Connected Environment Dapr Component.""" + + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CANCELED = "Canceled" + IN_PROGRESS = "InProgress" + DELETING = "Deleting" + + class ConnectedEnvironmentProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Provisioning state of the Kubernetes Environment.""" @@ -101,6 +156,16 @@ class ConnectedEnvironmentProvisioningState(str, Enum, metaclass=CaseInsensitive SCHEDULED_FOR_DELETE = "ScheduledForDelete" +class ConnectedEnvironmentStorageProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Provisioning state of the storage.""" + + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CANCELED = "Canceled" + IN_PROGRESS = "InProgress" + DELETING = "Deleting" + + class ContainerAppContainerRunningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Current running state of the container.""" @@ -165,6 +230,14 @@ class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): KEY = "Key" +class DetectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The status of the patch detection.""" + + SUCCEEDED = "Succeeded" + REGISTRY_LOGIN_FAILED = "RegistryLoginFailed" + FAILED = "Failed" + + class DnsVerificationTestResult(str, Enum, metaclass=CaseInsensitiveEnumMeta): """DNS verification test result.""" @@ -173,6 +246,22 @@ class DnsVerificationTestResult(str, Enum, metaclass=CaseInsensitiveEnumMeta): SKIPPED = "Skipped" +class DotNetComponentProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Provisioning state of the .NET Component.""" + + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CANCELED = "Canceled" + DELETING = "Deleting" + IN_PROGRESS = "InProgress" + + +class DotNetComponentType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of the .NET Component.""" + + ASPIRE_DASHBOARD = "AspireDashboard" + + class EnvironmentProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Provisioning state of the Environment.""" @@ -202,6 +291,18 @@ class ForwardProxyConvention(str, Enum, metaclass=CaseInsensitiveEnumMeta): CUSTOM = "Custom" +class HttpRouteProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The current provisioning state.""" + + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CANCELED = "Canceled" + WAITING = "Waiting" + UPDATING = "Updating" + DELETING = "Deleting" + PENDING = "Pending" + + class IdentitySettingsLifeCycle(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Use to select the lifecycle stages of a Container App during which the Managed Identity should be available. @@ -213,6 +314,15 @@ class IdentitySettingsLifeCycle(str, Enum, metaclass=CaseInsensitiveEnumMeta): ALL = "All" +class ImageType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of the image. Set to CloudBuild to let the system manages the image, where user will + not be able to update image through image field. Set to ContainerImage for user provided image. + """ + + CLOUD_BUILD = "CloudBuild" + CONTAINER_IMAGE = "ContainerImage" + + class IngressClientCertificateMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Client certificate mode for mTLS authentication. Ignore indicates server drops client certificate on forwarding. Accept indicates server forwards client certificate but does not @@ -224,6 +334,13 @@ class IngressClientCertificateMode(str, Enum, metaclass=CaseInsensitiveEnumMeta) REQUIRE = "require" +class IngressTargetPortHttpScheme(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Whether an http app listens on http or https.""" + + HTTP = "http" + HTTPS = "https" + + class IngressTransportMethod(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Ingress transport protocol.""" @@ -249,6 +366,8 @@ class JavaComponentType(str, Enum, metaclass=CaseInsensitiveEnumMeta): SPRING_BOOT_ADMIN = "SpringBootAdmin" SPRING_CLOUD_EUREKA = "SpringCloudEureka" SPRING_CLOUD_CONFIG = "SpringCloudConfig" + SPRING_CLOUD_GATEWAY = "SpringCloudGateway" + NACOS = "Nacos" class JobExecutionRunningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -273,6 +392,34 @@ class JobProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): DELETING = "Deleting" +class JobRunningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Current running state of the job.""" + + READY = "Ready" + PROGRESSING = "Progressing" + SUSPENDED = "Suspended" + + +class Kind(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Metadata used to render different experiences for resources of the same type; e.g. WorkflowApp + is a kind of Microsoft.App/ContainerApps type. If supported, the resource provider must + validate and persist this value. + """ + + WORKFLOWAPP = "workflowapp" + + +class Level(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The specified logger's log level.""" + + OFF = "off" + ERROR = "error" + INFO = "info" + DEBUG = "debug" + TRACE = "trace" + WARN = "warn" + + class LifecycleType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The lifecycle type of the session pool.""" @@ -280,6 +427,13 @@ class LifecycleType(str, Enum, metaclass=CaseInsensitiveEnumMeta): ON_CONTAINER_EXIT = "OnContainerExit" +class LogicAppsProxyMethod(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """LogicAppsProxyMethod.""" + + GET = "GET" + POST = "POST" + + class LogLevel(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Sets the log level for the Dapr sidecar. Allowed values are debug, info, warn, error. Default is info. @@ -310,6 +464,41 @@ class ManagedServiceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned,UserAssigned" +class PatchApplyStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The status of the patch once it has been provisioned.""" + + NOT_STARTED = "NotStarted" + REBASE_IN_PROGRESS = "RebaseInProgress" + CREATING_REVISION = "CreatingRevision" + SUCCEEDED = "Succeeded" + CANCELED = "Canceled" + REBASE_FAILED = "RebaseFailed" + REVISION_CREATION_FAILED = "RevisionCreationFailed" + IMAGE_PUSH_PULL_FAILED = "ImagePushPullFailed" + MANUALLY_SKIPPED = "ManuallySkipped" + + +class PatchingMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Patching mode for the container app. Null or default in this field will be interpreted as + Automatic by RP. Automatic mode will automatically apply available patches. Manual mode will + require the user to manually apply patches. Disabled mode will stop patch detection and auto + patching. + """ + + AUTOMATIC = "Automatic" + MANUAL = "Manual" + DISABLED = "Disabled" + + +class PatchType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type for the patch.""" + + FRAMEWORK_SECURITY = "FrameworkSecurity" + OS_SECURITY = "OSSecurity" + FRAMEWORK_AND_OS_SECURITY = "FrameworkAndOSSecurity" + OTHER = "Other" + + class PoolManagementType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The pool management type of the session pool.""" @@ -317,6 +506,34 @@ class PoolManagementType(str, Enum, metaclass=CaseInsensitiveEnumMeta): DYNAMIC = "Dynamic" +class PrivateEndpointConnectionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The current provisioning state.""" + + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CANCELED = "Canceled" + WAITING = "Waiting" + UPDATING = "Updating" + DELETING = "Deleting" + PENDING = "Pending" + + +class PrivateEndpointServiceConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The private endpoint connection status.""" + + PENDING = "Pending" + APPROVED = "Approved" + REJECTED = "Rejected" + DISCONNECTED = "Disconnected" + + +class PublicNetworkAccess(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Property to allow or block all public traffic. Allowed Values: 'Enabled', 'Disabled'.""" + + ENABLED = "Enabled" + DISABLED = "Disabled" + + class RevisionHealthState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Current health State of the revision.""" @@ -370,6 +587,16 @@ class SessionPoolProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta) DELETING = "Deleting" +class SessionProbeType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Denotes the type of probe. Can be Liveness or Startup, Readiness probe is not supported in + sessions. Type must be unique for each probe within the context of a list of probes + (SessionProbes). + """ + + LIVENESS = "Liveness" + STARTUP = "Startup" + + class SourceControlOperationState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Current provisioning State of the operation.""" @@ -379,6 +606,14 @@ class SourceControlOperationState(str, Enum, metaclass=CaseInsensitiveEnumMeta): CANCELED = "Canceled" +class Status(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Status of the label history record.""" + + SUCCEEDED = "Succeeded" + FAILED = "Failed" + STARTING = "Starting" + + class StorageType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Storage type for the volume. If not provided, use EmptyDir.""" @@ -386,6 +621,7 @@ class StorageType(str, Enum, metaclass=CaseInsensitiveEnumMeta): EMPTY_DIR = "EmptyDir" SECRET = "Secret" NFS_AZURE_FILE = "NfsAzureFile" + SMB = "Smb" class TriggerType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -411,3 +647,35 @@ class UnauthenticatedClientActionV2(str, Enum, metaclass=CaseInsensitiveEnumMeta ALLOW_ANONYMOUS = "AllowAnonymous" RETURN401 = "Return401" RETURN403 = "Return403" + + +class WeekDay(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Day of the week when a managed environment can be patched.""" + + MONDAY = "Monday" + TUESDAY = "Tuesday" + WEDNESDAY = "Wednesday" + THURSDAY = "Thursday" + FRIDAY = "Friday" + SATURDAY = "Saturday" + SUNDAY = "Sunday" + + +class WorkflowHealthState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Gets or sets the workflow health state.""" + + NOT_SPECIFIED = "NotSpecified" + HEALTHY = "Healthy" + UNHEALTHY = "Unhealthy" + UNKNOWN = "Unknown" + + +class WorkflowState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The workflow state.""" + + NOT_SPECIFIED = "NotSpecified" + COMPLETED = "Completed" + ENABLED = "Enabled" + DISABLED = "Disabled" + DELETED = "Deleted" + SUSPENDED = "Suspended" diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/models/_models_py3.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/models/_models_py3.py index f2c04cc5fcc0..ddf01418e809 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,20 +7,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping import datetime -import sys from typing import Any, Dict, List, Literal, Optional, TYPE_CHECKING, Union from .. import _serialization -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore - if TYPE_CHECKING: from .. import models as _models -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] class AllowedAudiencesValidation(_serialization.Model): @@ -73,6 +68,26 @@ def __init__( self.identities = identities +class AppInsightsConfiguration(_serialization.Model): + """Configuration of Application Insights. + + :ivar connection_string: Application Insights connection string. + :vartype connection_string: str + """ + + _attribute_map = { + "connection_string": {"key": "connectionString", "type": "str"}, + } + + def __init__(self, *, connection_string: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword connection_string: Application Insights connection string. + :paramtype connection_string: str + """ + super().__init__(**kwargs) + self.connection_string = connection_string + + class Apple(_serialization.Model): """The configuration settings of the Apple provider. @@ -213,7 +228,7 @@ class Resource(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -242,10 +257,10 @@ class Resource(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.system_data = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None + self.system_data: Optional["_models.SystemData"] = None class ProxyResource(Resource): @@ -255,7 +270,26 @@ class ProxyResource(Resource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + "/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 + """ + + +class AppResiliency(ProxyResource): + """Configuration to setup App Resiliency. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -265,8 +299,106 @@ class ProxyResource(Resource): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData + :ivar timeout_policy: Policy to set request timeouts. + :vartype timeout_policy: ~azure.mgmt.appcontainers.models.TimeoutPolicy + :ivar http_retry_policy: Policy that defines http request retry conditions. + :vartype http_retry_policy: ~azure.mgmt.appcontainers.models.HttpRetryPolicy + :ivar tcp_retry_policy: Policy that defines tcp request retry conditions. + :vartype tcp_retry_policy: ~azure.mgmt.appcontainers.models.TcpRetryPolicy + :ivar circuit_breaker_policy: Policy that defines circuit breaker conditions. + :vartype circuit_breaker_policy: ~azure.mgmt.appcontainers.models.CircuitBreakerPolicy + :ivar http_connection_pool: Defines parameters for http connection pooling. + :vartype http_connection_pool: ~azure.mgmt.appcontainers.models.HttpConnectionPool + :ivar tcp_connection_pool: Defines parameters for tcp connection pooling. + :vartype tcp_connection_pool: ~azure.mgmt.appcontainers.models.TcpConnectionPool + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "timeout_policy": {"key": "properties.timeoutPolicy", "type": "TimeoutPolicy"}, + "http_retry_policy": {"key": "properties.httpRetryPolicy", "type": "HttpRetryPolicy"}, + "tcp_retry_policy": {"key": "properties.tcpRetryPolicy", "type": "TcpRetryPolicy"}, + "circuit_breaker_policy": {"key": "properties.circuitBreakerPolicy", "type": "CircuitBreakerPolicy"}, + "http_connection_pool": {"key": "properties.httpConnectionPool", "type": "HttpConnectionPool"}, + "tcp_connection_pool": {"key": "properties.tcpConnectionPool", "type": "TcpConnectionPool"}, + } + + def __init__( + self, + *, + timeout_policy: Optional["_models.TimeoutPolicy"] = None, + http_retry_policy: Optional["_models.HttpRetryPolicy"] = None, + tcp_retry_policy: Optional["_models.TcpRetryPolicy"] = None, + circuit_breaker_policy: Optional["_models.CircuitBreakerPolicy"] = None, + http_connection_pool: Optional["_models.HttpConnectionPool"] = None, + tcp_connection_pool: Optional["_models.TcpConnectionPool"] = None, + **kwargs: Any + ) -> None: + """ + :keyword timeout_policy: Policy to set request timeouts. + :paramtype timeout_policy: ~azure.mgmt.appcontainers.models.TimeoutPolicy + :keyword http_retry_policy: Policy that defines http request retry conditions. + :paramtype http_retry_policy: ~azure.mgmt.appcontainers.models.HttpRetryPolicy + :keyword tcp_retry_policy: Policy that defines tcp request retry conditions. + :paramtype tcp_retry_policy: ~azure.mgmt.appcontainers.models.TcpRetryPolicy + :keyword circuit_breaker_policy: Policy that defines circuit breaker conditions. + :paramtype circuit_breaker_policy: ~azure.mgmt.appcontainers.models.CircuitBreakerPolicy + :keyword http_connection_pool: Defines parameters for http connection pooling. + :paramtype http_connection_pool: ~azure.mgmt.appcontainers.models.HttpConnectionPool + :keyword tcp_connection_pool: Defines parameters for tcp connection pooling. + :paramtype tcp_connection_pool: ~azure.mgmt.appcontainers.models.TcpConnectionPool + """ + super().__init__(**kwargs) + self.timeout_policy = timeout_policy + self.http_retry_policy = http_retry_policy + self.tcp_retry_policy = tcp_retry_policy + self.circuit_breaker_policy = circuit_breaker_policy + self.http_connection_pool = http_connection_pool + self.tcp_connection_pool = tcp_connection_pool + + +class AppResiliencyCollection(_serialization.Model): + """Collection of AppResiliency policies. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar value: Collection of resources. Required. + :vartype value: list[~azure.mgmt.appcontainers.models.AppResiliency] + :ivar next_link: Link to next page of resources. + :vartype next_link: str """ + _validation = { + "value": {"required": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[AppResiliency]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.AppResiliency"], **kwargs: Any) -> None: + """ + :keyword value: Collection of resources. Required. + :paramtype value: list[~azure.mgmt.appcontainers.models.AppResiliency] + """ + super().__init__(**kwargs) + self.value = value + self.next_link: Optional[str] = None + class AuthConfig(ProxyResource): """Configuration settings for the Azure ContainerApp Service Authentication / Authorization @@ -275,7 +407,7 @@ class AuthConfig(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -395,7 +527,7 @@ def __init__(self, *, value: List["_models.AuthConfig"], **kwargs: Any) -> None: """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class AuthPlatform(_serialization.Model): @@ -469,7 +601,7 @@ class AvailableWorkloadProfile(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -611,7 +743,7 @@ def __init__(self, *, value: List["_models.AvailableWorkloadProfile"], **kwargs: """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class AzureActiveDirectory(_serialization.Model): @@ -924,6 +1056,9 @@ class AzureFileProperties(_serialization.Model): :vartype account_name: str :ivar account_key: Storage account key for azure file. :vartype account_key: str + :ivar account_key_vault_properties: Storage account key stored as an Azure Key Vault secret. + :vartype account_key_vault_properties: + ~azure.mgmt.appcontainers.models.SecretKeyVaultProperties :ivar access_mode: Access mode for storage. Known values are: "ReadOnly" and "ReadWrite". :vartype access_mode: str or ~azure.mgmt.appcontainers.models.AccessMode :ivar share_name: Azure file share name. @@ -933,6 +1068,7 @@ class AzureFileProperties(_serialization.Model): _attribute_map = { "account_name": {"key": "accountName", "type": "str"}, "account_key": {"key": "accountKey", "type": "str"}, + "account_key_vault_properties": {"key": "accountKeyVaultProperties", "type": "SecretKeyVaultProperties"}, "access_mode": {"key": "accessMode", "type": "str"}, "share_name": {"key": "shareName", "type": "str"}, } @@ -942,6 +1078,7 @@ def __init__( *, account_name: Optional[str] = None, account_key: Optional[str] = None, + account_key_vault_properties: Optional["_models.SecretKeyVaultProperties"] = None, access_mode: Optional[Union[str, "_models.AccessMode"]] = None, share_name: Optional[str] = None, **kwargs: Any @@ -951,6 +1088,9 @@ def __init__( :paramtype account_name: str :keyword account_key: Storage account key for azure file. :paramtype account_key: str + :keyword account_key_vault_properties: Storage account key stored as an Azure Key Vault secret. + :paramtype account_key_vault_properties: + ~azure.mgmt.appcontainers.models.SecretKeyVaultProperties :keyword access_mode: Access mode for storage. Known values are: "ReadOnly" and "ReadWrite". :paramtype access_mode: str or ~azure.mgmt.appcontainers.models.AccessMode :keyword share_name: Azure file share name. @@ -959,6 +1099,7 @@ def __init__( super().__init__(**kwargs) self.account_name = account_name self.account_key = account_key + self.account_key_vault_properties = account_key_vault_properties self.access_mode = access_mode self.share_name = share_name @@ -1022,6 +1163,10 @@ class BaseContainer(_serialization.Model): :ivar image: Container image tag. :vartype image: str + :ivar image_type: The type of the image. Set to CloudBuild to let the system manages the image, + where user will not be able to update image through image field. Set to ContainerImage for user + provided image. Known values are: "CloudBuild" and "ContainerImage". + :vartype image_type: str or ~azure.mgmt.appcontainers.models.ImageType :ivar name: Custom container name. :vartype name: str :ivar command: Container start command. @@ -1038,6 +1183,7 @@ class BaseContainer(_serialization.Model): _attribute_map = { "image": {"key": "image", "type": "str"}, + "image_type": {"key": "imageType", "type": "str"}, "name": {"key": "name", "type": "str"}, "command": {"key": "command", "type": "[str]"}, "args": {"key": "args", "type": "[str]"}, @@ -1050,6 +1196,7 @@ def __init__( self, *, image: Optional[str] = None, + image_type: Optional[Union[str, "_models.ImageType"]] = None, name: Optional[str] = None, command: Optional[List[str]] = None, args: Optional[List[str]] = None, @@ -1061,6 +1208,10 @@ def __init__( """ :keyword image: Container image tag. :paramtype image: str + :keyword image_type: The type of the image. Set to CloudBuild to let the system manages the + image, where user will not be able to update image through image field. Set to ContainerImage + for user provided image. Known values are: "CloudBuild" and "ContainerImage". + :paramtype image_type: str or ~azure.mgmt.appcontainers.models.ImageType :keyword name: Custom container name. :paramtype name: str :keyword command: Container start command. @@ -1076,6 +1227,7 @@ def __init__( """ super().__init__(**kwargs) self.image = image + self.image_type = image_type self.name = name self.command = command self.args = args @@ -1084,13 +1236,13 @@ def __init__( self.volume_mounts = volume_mounts -class BillingMeter(ProxyResource): +class BillingMeter(_serialization.Model): """Billing meter. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + :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 @@ -1136,6 +1288,10 @@ def __init__( :paramtype properties: ~azure.mgmt.appcontainers.models.BillingMeterProperties """ super().__init__(**kwargs) + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None + self.system_data: Optional["_models.SystemData"] = None self.location = location self.properties = properties @@ -1208,29 +1364,176 @@ def __init__( class BlobStorageTokenStore(_serialization.Model): """The configuration settings of the storage of the tokens if blob storage is used. - All required parameters must be populated in order to send to server. - :ivar sas_url_setting_name: The name of the app secrets containing the SAS URL of the blob - storage containing the tokens. Required. + storage containing the tokens. Should not be used along with blobContainerUri. :vartype sas_url_setting_name: str + :ivar blob_container_uri: The URI of the blob storage containing the tokens. Should not be used + along with sasUrlSettingName. + :vartype blob_container_uri: str + :ivar client_id: The Client ID of a User-Assigned Managed Identity. Should not be used along + with managedIdentityResourceId. + :vartype client_id: str + :ivar managed_identity_resource_id: The Resource ID of a User-Assigned Managed Identity. Should + not be used along with clientId. + :vartype managed_identity_resource_id: str """ - _validation = { - "sas_url_setting_name": {"required": True}, - } - _attribute_map = { "sas_url_setting_name": {"key": "sasUrlSettingName", "type": "str"}, + "blob_container_uri": {"key": "blobContainerUri", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + "managed_identity_resource_id": {"key": "managedIdentityResourceId", "type": "str"}, } - def __init__(self, *, sas_url_setting_name: str, **kwargs: Any) -> None: + def __init__( + self, + *, + sas_url_setting_name: Optional[str] = None, + blob_container_uri: Optional[str] = None, + client_id: Optional[str] = None, + managed_identity_resource_id: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword sas_url_setting_name: The name of the app secrets containing the SAS URL of the blob - storage containing the tokens. Required. + storage containing the tokens. Should not be used along with blobContainerUri. :paramtype sas_url_setting_name: str + :keyword blob_container_uri: The URI of the blob storage containing the tokens. Should not be + used along with sasUrlSettingName. + :paramtype blob_container_uri: str + :keyword client_id: The Client ID of a User-Assigned Managed Identity. Should not be used along + with managedIdentityResourceId. + :paramtype client_id: str + :keyword managed_identity_resource_id: The Resource ID of a User-Assigned Managed Identity. + Should not be used along with clientId. + :paramtype managed_identity_resource_id: str """ super().__init__(**kwargs) self.sas_url_setting_name = sas_url_setting_name + self.blob_container_uri = blob_container_uri + self.client_id = client_id + self.managed_identity_resource_id = managed_identity_resource_id + + +class BuildCollection(_serialization.Model): + """The response of a BuildResource list operation. + + All required parameters must be populated in order to send to server. + + :ivar value: The BuildResource items on this page. Required. + :vartype value: list[~azure.mgmt.appcontainers.models.BuildResource] + :ivar next_link: The link to the next page of items. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[BuildResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.BuildResource"], next_link: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword value: The BuildResource items on this page. Required. + :paramtype value: list[~azure.mgmt.appcontainers.models.BuildResource] + :keyword next_link: The link to the next page of items. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class BuildConfiguration(_serialization.Model): + """Configuration of the build. + + :ivar base_os: Base OS used to build and run the app. + :vartype base_os: str + :ivar platform: Platform to be used to build and run the app. + :vartype platform: str + :ivar platform_version: Platform version to be used to build and run the app. + :vartype platform_version: str + :ivar environment_variables: List of environment variables to be passed to the build, secrets + should not be used in environment variable. + :vartype environment_variables: list[~azure.mgmt.appcontainers.models.EnvironmentVariable] + :ivar pre_build_steps: List of steps to perform before the build. + :vartype pre_build_steps: list[~azure.mgmt.appcontainers.models.PreBuildStep] + """ + + _attribute_map = { + "base_os": {"key": "baseOs", "type": "str"}, + "platform": {"key": "platform", "type": "str"}, + "platform_version": {"key": "platformVersion", "type": "str"}, + "environment_variables": {"key": "environmentVariables", "type": "[EnvironmentVariable]"}, + "pre_build_steps": {"key": "preBuildSteps", "type": "[PreBuildStep]"}, + } + + def __init__( + self, + *, + base_os: Optional[str] = None, + platform: Optional[str] = None, + platform_version: Optional[str] = None, + environment_variables: Optional[List["_models.EnvironmentVariable"]] = None, + pre_build_steps: Optional[List["_models.PreBuildStep"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword base_os: Base OS used to build and run the app. + :paramtype base_os: str + :keyword platform: Platform to be used to build and run the app. + :paramtype platform: str + :keyword platform_version: Platform version to be used to build and run the app. + :paramtype platform_version: str + :keyword environment_variables: List of environment variables to be passed to the build, + secrets should not be used in environment variable. + :paramtype environment_variables: list[~azure.mgmt.appcontainers.models.EnvironmentVariable] + :keyword pre_build_steps: List of steps to perform before the build. + :paramtype pre_build_steps: list[~azure.mgmt.appcontainers.models.PreBuildStep] + """ + super().__init__(**kwargs) + self.base_os = base_os + self.platform = platform + self.platform_version = platform_version + self.environment_variables = environment_variables + self.pre_build_steps = pre_build_steps + + +class BuilderCollection(_serialization.Model): + """The response of a BuilderResource list operation. + + All required parameters must be populated in order to send to server. + + :ivar value: The BuilderResource items on this page. Required. + :vartype value: list[~azure.mgmt.appcontainers.models.BuilderResource] + :ivar next_link: The link to the next page of items. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[BuilderResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: List["_models.BuilderResource"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The BuilderResource items on this page. Required. + :paramtype value: list[~azure.mgmt.appcontainers.models.BuilderResource] + :keyword next_link: The link to the next page of items. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link class TrackedResource(Resource): @@ -1242,7 +1545,7 @@ class TrackedResource(Resource): All required parameters must be populated in order to send to server. :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -1287,15 +1590,15 @@ def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kw self.location = location -class Certificate(TrackedResource): - """Certificate used for Custom Domain bindings of Container Apps in a Managed Environment. +class BuilderResource(TrackedResource): + """Information about the SourceToCloud builder resource. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to server. :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -1309,8 +1612,17 @@ class Certificate(TrackedResource): :vartype tags: dict[str, str] :ivar location: The geo-location where the resource lives. Required. :vartype location: str - :ivar properties: Certificate resource specific properties. - :vartype properties: ~azure.mgmt.appcontainers.models.CertificateProperties + :ivar identity: The managed service identities assigned to this resource. + :vartype identity: ~azure.mgmt.appcontainers.models.ManagedServiceIdentity + :ivar provisioning_state: Provisioning state of a builder resource. Known values are: + "Succeeded", "Failed", "Canceled", "Creating", "Updating", and "Deleting". + :vartype provisioning_state: str or ~azure.mgmt.appcontainers.models.BuilderProvisioningState + :ivar environment_id: Resource ID of the container apps environment that the builder is + associated with. + :vartype environment_id: str + :ivar container_registries: List of mappings of container registries and the managed identity + used to connect to it. + :vartype container_registries: list[~azure.mgmt.appcontainers.models.ContainerRegistry] """ _validation = { @@ -1319,6 +1631,7 @@ class Certificate(TrackedResource): "type": {"readonly": True}, "system_data": {"readonly": True}, "location": {"required": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { @@ -1328,7 +1641,10 @@ class Certificate(TrackedResource): "system_data": {"key": "systemData", "type": "SystemData"}, "tags": {"key": "tags", "type": "{str}"}, "location": {"key": "location", "type": "str"}, - "properties": {"key": "properties", "type": "CertificateProperties"}, + "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "environment_id": {"key": "properties.environmentId", "type": "str"}, + "container_registries": {"key": "properties.containerRegistries", "type": "[ContainerRegistry]"}, } def __init__( @@ -1336,7 +1652,9 @@ def __init__( *, location: str, tags: Optional[Dict[str, str]] = None, - properties: Optional["_models.CertificateProperties"] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, + environment_id: Optional[str] = None, + container_registries: Optional[List["_models.ContainerRegistry"]] = None, **kwargs: Any ) -> None: """ @@ -1344,66 +1662,299 @@ def __init__( :paramtype tags: dict[str, str] :keyword location: The geo-location where the resource lives. Required. :paramtype location: str - :keyword properties: Certificate resource specific properties. - :paramtype properties: ~azure.mgmt.appcontainers.models.CertificateProperties + :keyword identity: The managed service identities assigned to this resource. + :paramtype identity: ~azure.mgmt.appcontainers.models.ManagedServiceIdentity + :keyword environment_id: Resource ID of the container apps environment that the builder is + associated with. + :paramtype environment_id: str + :keyword container_registries: List of mappings of container registries and the managed + identity used to connect to it. + :paramtype container_registries: list[~azure.mgmt.appcontainers.models.ContainerRegistry] """ super().__init__(tags=tags, location=location, **kwargs) - self.properties = properties - - -class CertificateCollection(_serialization.Model): - """Collection of Certificates. + self.identity = identity + self.provisioning_state: Optional[Union[str, "_models.BuilderProvisioningState"]] = None + self.environment_id = environment_id + self.container_registries = container_registries - Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to server. +class BuilderResourceUpdate(_serialization.Model): + """The type used for update operations of the BuilderResource. - :ivar value: Collection of resources. Required. - :vartype value: list[~azure.mgmt.appcontainers.models.Certificate] - :ivar next_link: Link to next page of resources. - :vartype next_link: str + :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 """ - _validation = { - "value": {"required": True}, - "next_link": {"readonly": True}, - } - _attribute_map = { - "value": {"key": "value", "type": "[Certificate]"}, - "next_link": {"key": "nextLink", "type": "str"}, + "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, + "tags": {"key": "tags", "type": "{str}"}, + "environment_id": {"key": "properties.environmentId", "type": "str"}, } - def __init__(self, *, value: List["_models.Certificate"], **kwargs: Any) -> None: + def __init__( + self, + *, + identity: Optional["_models.ManagedServiceIdentity"] = None, + tags: Optional[Dict[str, str]] = None, + environment_id: Optional[str] = None, + **kwargs: Any + ) -> None: """ - :keyword value: Collection of resources. Required. - :paramtype value: list[~azure.mgmt.appcontainers.models.Certificate] + :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.value = value - self.next_link = None + self.identity = identity + self.tags = tags + self.environment_id = environment_id -class CertificateKeyVaultProperties(_serialization.Model): - """Properties for a certificate stored in a Key Vault. +class BuildResource(ProxyResource): + """Information pertaining to an individual build. - :ivar identity: Resource ID of a managed identity to authenticate with Azure Key Vault, or - System to use a system-assigned identity. - :vartype identity: str - :ivar key_vault_url: URL pointing to the Azure Key Vault secret that holds the certificate. - :vartype key_vault_url: str + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData + :ivar provisioning_state: Build provisioning state. Known values are: "Succeeded", "Failed", + "Canceled", "Creating", "Updating", and "Deleting". + :vartype provisioning_state: str or ~azure.mgmt.appcontainers.models.BuildProvisioningState + :ivar build_status: Status of the build once it has been provisioned. Known values are: + "NotStarted", "InProgress", "Succeeded", "Canceled", and "Failed". + :vartype build_status: str or ~azure.mgmt.appcontainers.models.BuildStatus + :ivar destination_container_registry: Container registry that the final image will be uploaded + to. + :vartype destination_container_registry: + ~azure.mgmt.appcontainers.models.ContainerRegistryWithCustomImage + :ivar configuration: Configuration of the build. + :vartype configuration: ~azure.mgmt.appcontainers.models.BuildConfiguration + :ivar upload_endpoint: Endpoint to which the source code should be uploaded. + :vartype upload_endpoint: str + :ivar log_stream_endpoint: Endpoint from which the build logs can be streamed. + :vartype log_stream_endpoint: str + :ivar token_endpoint: Endpoint to use to retrieve an authentication token for log streaming and + uploading source code. + :vartype token_endpoint: str """ - _attribute_map = { - "identity": {"key": "identity", "type": "str"}, - "key_vault_url": {"key": "keyVaultUrl", "type": "str"}, + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "build_status": {"readonly": True}, + "upload_endpoint": {"readonly": True}, + "log_stream_endpoint": {"readonly": True}, + "token_endpoint": {"readonly": True}, } - def __init__(self, *, identity: Optional[str] = None, key_vault_url: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword identity: Resource ID of a managed identity to authenticate with Azure Key Vault, or - System to use a system-assigned identity. - :paramtype identity: str + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "build_status": {"key": "properties.buildStatus", "type": "str"}, + "destination_container_registry": { + "key": "properties.destinationContainerRegistry", + "type": "ContainerRegistryWithCustomImage", + }, + "configuration": {"key": "properties.configuration", "type": "BuildConfiguration"}, + "upload_endpoint": {"key": "properties.uploadEndpoint", "type": "str"}, + "log_stream_endpoint": {"key": "properties.logStreamEndpoint", "type": "str"}, + "token_endpoint": {"key": "properties.tokenEndpoint", "type": "str"}, + } + + def __init__( + self, + *, + destination_container_registry: Optional["_models.ContainerRegistryWithCustomImage"] = None, + configuration: Optional["_models.BuildConfiguration"] = None, + **kwargs: Any + ) -> None: + """ + :keyword destination_container_registry: Container registry that the final image will be + uploaded to. + :paramtype destination_container_registry: + ~azure.mgmt.appcontainers.models.ContainerRegistryWithCustomImage + :keyword configuration: Configuration of the build. + :paramtype configuration: ~azure.mgmt.appcontainers.models.BuildConfiguration + """ + super().__init__(**kwargs) + self.provisioning_state: Optional[Union[str, "_models.BuildProvisioningState"]] = None + self.build_status: Optional[Union[str, "_models.BuildStatus"]] = None + self.destination_container_registry = destination_container_registry + self.configuration = configuration + self.upload_endpoint: Optional[str] = None + self.log_stream_endpoint: Optional[str] = None + self.token_endpoint: Optional[str] = None + + +class BuildToken(_serialization.Model): + """Build Auth Token. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar token: Authentication token. + :vartype token: str + :ivar expires: Token expiration date. + :vartype expires: ~datetime.datetime + """ + + _validation = { + "token": {"readonly": True}, + "expires": {"readonly": True}, + } + + _attribute_map = { + "token": {"key": "token", "type": "str"}, + "expires": {"key": "expires", "type": "iso-8601"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.token: Optional[str] = None + self.expires: Optional[datetime.datetime] = None + + +class Certificate(TrackedResource): + """Certificate used for Custom Domain bindings of Container Apps in a Managed Environment. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar properties: Certificate resource specific properties. + :vartype properties: ~azure.mgmt.appcontainers.models.CertificateProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "properties": {"key": "properties", "type": "CertificateProperties"}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + properties: Optional["_models.CertificateProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str + :keyword properties: Certificate resource specific properties. + :paramtype properties: ~azure.mgmt.appcontainers.models.CertificateProperties + """ + super().__init__(tags=tags, location=location, **kwargs) + self.properties = properties + + +class CertificateCollection(_serialization.Model): + """Collection of Certificates. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar value: Collection of resources. Required. + :vartype value: list[~azure.mgmt.appcontainers.models.Certificate] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[Certificate]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.Certificate"], **kwargs: Any) -> None: + """ + :keyword value: Collection of resources. Required. + :paramtype value: list[~azure.mgmt.appcontainers.models.Certificate] + """ + super().__init__(**kwargs) + self.value = value + self.next_link: Optional[str] = None + + +class CertificateKeyVaultProperties(_serialization.Model): + """Properties for a certificate stored in a Key Vault. + + :ivar identity: Resource ID of a managed identity to authenticate with Azure Key Vault, or + System to use a system-assigned identity. + :vartype identity: str + :ivar key_vault_url: URL pointing to the Azure Key Vault secret that holds the certificate. + :vartype key_vault_url: str + """ + + _attribute_map = { + "identity": {"key": "identity", "type": "str"}, + "key_vault_url": {"key": "keyVaultUrl", "type": "str"}, + } + + def __init__(self, *, identity: Optional[str] = None, key_vault_url: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword identity: Resource ID of a managed identity to authenticate with Azure Key Vault, or + System to use a system-assigned identity. + :paramtype identity: str :keyword key_vault_url: URL pointing to the Azure Key Vault secret that holds the certificate. :paramtype key_vault_url: str """ @@ -1438,9 +1989,11 @@ class CertificateProperties(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar provisioning_state: Provisioning state of the certificate. Known values are: "Succeeded", - "Failed", "Canceled", "DeleteFailed", and "Pending". + "Failed", "Canceled", "DeleteFailed", "Pending", and "Deleting". :vartype provisioning_state: str or ~azure.mgmt.appcontainers.models.CertificateProvisioningState + :ivar deployment_errors: Any errors that occurred during deployment or deployment validation. + :vartype deployment_errors: str :ivar certificate_key_vault_properties: Properties for a certificate stored in a Key Vault. :vartype certificate_key_vault_properties: ~azure.mgmt.appcontainers.models.CertificateKeyVaultProperties @@ -1464,10 +2017,15 @@ class CertificateProperties(_serialization.Model): :vartype valid: bool :ivar public_key_hash: Public key hash. :vartype public_key_hash: str + :ivar certificate_type: The type of the certificate. Allowed values are + ``ServerSSLCertificate`` and ``ImagePullTrustedCA``. Known values are: "ServerSSLCertificate" + and "ImagePullTrustedCA". + :vartype certificate_type: str or ~azure.mgmt.appcontainers.models.CertificateType """ _validation = { "provisioning_state": {"readonly": True}, + "deployment_errors": {"readonly": True}, "subject_name": {"readonly": True}, "subject_alternative_names": {"readonly": True}, "issuer": {"readonly": True}, @@ -1480,6 +2038,7 @@ class CertificateProperties(_serialization.Model): _attribute_map = { "provisioning_state": {"key": "provisioningState", "type": "str"}, + "deployment_errors": {"key": "deploymentErrors", "type": "str"}, "certificate_key_vault_properties": { "key": "certificateKeyVaultProperties", "type": "CertificateKeyVaultProperties", @@ -1494,6 +2053,7 @@ class CertificateProperties(_serialization.Model): "thumbprint": {"key": "thumbprint", "type": "str"}, "valid": {"key": "valid", "type": "bool"}, "public_key_hash": {"key": "publicKeyHash", "type": "str"}, + "certificate_type": {"key": "certificateType", "type": "str"}, } def __init__( @@ -1502,6 +2062,7 @@ def __init__( certificate_key_vault_properties: Optional["_models.CertificateKeyVaultProperties"] = None, password: Optional[str] = None, value: Optional[bytes] = None, + certificate_type: Optional[Union[str, "_models.CertificateType"]] = None, **kwargs: Any ) -> None: """ @@ -1512,20 +2073,26 @@ def __init__( :paramtype password: str :keyword value: PFX or PEM blob. :paramtype value: bytes + :keyword certificate_type: The type of the certificate. Allowed values are + ``ServerSSLCertificate`` and ``ImagePullTrustedCA``. Known values are: "ServerSSLCertificate" + and "ImagePullTrustedCA". + :paramtype certificate_type: str or ~azure.mgmt.appcontainers.models.CertificateType """ super().__init__(**kwargs) - self.provisioning_state = None + self.provisioning_state: Optional[Union[str, "_models.CertificateProvisioningState"]] = None + self.deployment_errors: Optional[str] = None self.certificate_key_vault_properties = certificate_key_vault_properties self.password = password - self.subject_name = None - self.subject_alternative_names = None + self.subject_name: Optional[str] = None + self.subject_alternative_names: Optional[List[str]] = None self.value = value - self.issuer = None - self.issue_date = None - self.expiration_date = None - self.thumbprint = None - self.valid = None - self.public_key_hash = None + self.issuer: Optional[str] = None + self.issue_date: Optional[datetime.datetime] = None + self.expiration_date: Optional[datetime.datetime] = None + self.thumbprint: Optional[str] = None + self.valid: Optional[bool] = None + self.public_key_hash: Optional[str] = None + self.certificate_type = certificate_type class CheckNameAvailabilityRequest(_serialization.Model): @@ -1595,6 +2162,51 @@ def __init__( self.message = message +class CircuitBreakerPolicy(_serialization.Model): + """Policy that defines circuit breaker conditions. + + :ivar consecutive_errors: Number of consecutive errors before the circuit breaker opens. + :vartype consecutive_errors: int + :ivar interval_in_seconds: The time interval, in seconds, between endpoint checks. This can + result in opening the circuit breaker if the check fails as well as closing the circuit breaker + if the check succeeds. Defaults to 10s. + :vartype interval_in_seconds: int + :ivar max_ejection_percent: Maximum percentage of hosts that will be ejected after failure + threshold has been met. + :vartype max_ejection_percent: int + """ + + _attribute_map = { + "consecutive_errors": {"key": "consecutiveErrors", "type": "int"}, + "interval_in_seconds": {"key": "intervalInSeconds", "type": "int"}, + "max_ejection_percent": {"key": "maxEjectionPercent", "type": "int"}, + } + + def __init__( + self, + *, + consecutive_errors: Optional[int] = None, + interval_in_seconds: Optional[int] = None, + max_ejection_percent: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword consecutive_errors: Number of consecutive errors before the circuit breaker opens. + :paramtype consecutive_errors: int + :keyword interval_in_seconds: The time interval, in seconds, between endpoint checks. This can + result in opening the circuit breaker if the check fails as well as closing the circuit breaker + if the check succeeds. Defaults to 10s. + :paramtype interval_in_seconds: int + :keyword max_ejection_percent: Maximum percentage of hosts that will be ejected after failure + threshold has been met. + :paramtype max_ejection_percent: int + """ + super().__init__(**kwargs) + self.consecutive_errors = consecutive_errors + self.interval_in_seconds = interval_in_seconds + self.max_ejection_percent = max_ejection_percent + + class ClientRegistration(_serialization.Model): """The configuration settings of the app registration for providers that have client ids and client secrets. @@ -1636,10 +2248,15 @@ class Configuration(_serialization.Model): .. raw:: html - Multiple: multiple revisions can be active.Single: Only one - revision can be active at a time. Revision weights can not be used in this mode. If no value if - provided, this is the default.. Known values are: "Multiple" and "Single". + Single: Only one revision can be active at a time. Traffic weights cannot be + used. This is the default.Multiple: Multiple revisions can be active, including + optional traffic weights and labels.Labels: Only revisions with labels are active. + Traffic weights can be applied to labels.. Known values are: "Multiple", + "Single", and "Labels". :vartype active_revisions_mode: str or ~azure.mgmt.appcontainers.models.ActiveRevisionsMode + :ivar target_label: Required in labels revisions mode. Label to apply to newly created + revision. + :vartype target_label: str :ivar ingress: Ingress configurations. :vartype ingress: ~azure.mgmt.appcontainers.models.Ingress :ivar registries: Collection of private container registry credentials for containers used by @@ -1651,6 +2268,10 @@ class Configuration(_serialization.Model): :vartype runtime: ~azure.mgmt.appcontainers.models.Runtime :ivar max_inactive_revisions: Optional. Max inactive revisions a Container App can have. :vartype max_inactive_revisions: int + :ivar revision_transition_threshold: Optional. The percent of the total number of replicas that + must be brought up before revision transition occurs. Defaults to 100 when none is given. Value + must be greater than 0 and less than or equal to 100. + :vartype revision_transition_threshold: int :ivar service: Container App to be a dev Container App Service. :vartype service: ~azure.mgmt.appcontainers.models.Service :ivar identity_settings: Optional settings for Managed Identities that are assigned to the @@ -1658,14 +2279,20 @@ class Configuration(_serialization.Model): :vartype identity_settings: list[~azure.mgmt.appcontainers.models.IdentitySettings] """ + _validation = { + "revision_transition_threshold": {"maximum": 100, "minimum": 1}, + } + _attribute_map = { "secrets": {"key": "secrets", "type": "[Secret]"}, "active_revisions_mode": {"key": "activeRevisionsMode", "type": "str"}, + "target_label": {"key": "targetLabel", "type": "str"}, "ingress": {"key": "ingress", "type": "Ingress"}, "registries": {"key": "registries", "type": "[RegistryCredentials]"}, "dapr": {"key": "dapr", "type": "Dapr"}, "runtime": {"key": "runtime", "type": "Runtime"}, "max_inactive_revisions": {"key": "maxInactiveRevisions", "type": "int"}, + "revision_transition_threshold": {"key": "revisionTransitionThreshold", "type": "int"}, "service": {"key": "service", "type": "Service"}, "identity_settings": {"key": "identitySettings", "type": "[IdentitySettings]"}, } @@ -1675,11 +2302,13 @@ def __init__( *, secrets: Optional[List["_models.Secret"]] = None, active_revisions_mode: Union[str, "_models.ActiveRevisionsMode"] = "Single", + target_label: Optional[str] = None, ingress: Optional["_models.Ingress"] = None, registries: Optional[List["_models.RegistryCredentials"]] = None, dapr: Optional["_models.Dapr"] = None, runtime: Optional["_models.Runtime"] = None, max_inactive_revisions: Optional[int] = None, + revision_transition_threshold: Optional[int] = None, service: Optional["_models.Service"] = None, identity_settings: Optional[List["_models.IdentitySettings"]] = None, **kwargs: Any @@ -1693,10 +2322,15 @@ def __init__( .. raw:: html - Multiple: multiple revisions can be active.Single: Only one - revision can be active at a time. Revision weights can not be used in this mode. If no value if - provided, this is the default.. Known values are: "Multiple" and "Single". + Single: Only one revision can be active at a time. Traffic weights cannot be + used. This is the default.Multiple: Multiple revisions can be active, including + optional traffic weights and labels.Labels: Only revisions with labels are active. + Traffic weights can be applied to labels.. Known values are: "Multiple", + "Single", and "Labels". :paramtype active_revisions_mode: str or ~azure.mgmt.appcontainers.models.ActiveRevisionsMode + :keyword target_label: Required in labels revisions mode. Label to apply to newly created + revision. + :paramtype target_label: str :keyword ingress: Ingress configurations. :paramtype ingress: ~azure.mgmt.appcontainers.models.Ingress :keyword registries: Collection of private container registry credentials for containers used @@ -1708,6 +2342,10 @@ def __init__( :paramtype runtime: ~azure.mgmt.appcontainers.models.Runtime :keyword max_inactive_revisions: Optional. Max inactive revisions a Container App can have. :paramtype max_inactive_revisions: int + :keyword revision_transition_threshold: Optional. The percent of the total number of replicas + that must be brought up before revision transition occurs. Defaults to 100 when none is given. + Value must be greater than 0 and less than or equal to 100. + :paramtype revision_transition_threshold: int :keyword service: Container App to be a dev Container App Service. :paramtype service: ~azure.mgmt.appcontainers.models.Service :keyword identity_settings: Optional settings for Managed Identities that are assigned to the @@ -1717,11 +2355,13 @@ def __init__( super().__init__(**kwargs) self.secrets = secrets self.active_revisions_mode = active_revisions_mode + self.target_label = target_label self.ingress = ingress self.registries = registries self.dapr = dapr self.runtime = runtime self.max_inactive_revisions = max_inactive_revisions + self.revision_transition_threshold = revision_transition_threshold self.service = service self.identity_settings = identity_settings @@ -1734,7 +2374,7 @@ class ConnectedEnvironment(TrackedResource): All required parameters must be populated in order to send to server. :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -1828,9 +2468,9 @@ def __init__( """ super().__init__(tags=tags, location=location, **kwargs) self.extended_location = extended_location - self.provisioning_state = None - self.deployment_errors = None - self.default_domain = None + self.provisioning_state: Optional[Union[str, "_models.ConnectedEnvironmentProvisioningState"]] = None + self.deployment_errors: Optional[str] = None + self.default_domain: Optional[str] = None self.static_ip = static_ip self.dapr_ai_connection_string = dapr_ai_connection_string self.custom_domain_configuration = custom_domain_configuration @@ -1863,16 +2503,16 @@ def __init__(self, *, value: Optional[List["_models.ConnectedEnvironment"]] = No """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None -class ConnectedEnvironmentStorage(ProxyResource): - """Storage resource for connectedEnvironment. +class ConnectedEnvironmentDaprComponent(ProxyResource): + """Dapr Component. Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -1882,8 +2522,32 @@ class ConnectedEnvironmentStorage(ProxyResource): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData - :ivar properties: Storage properties. - :vartype properties: ~azure.mgmt.appcontainers.models.ConnectedEnvironmentStorageProperties + :ivar component_type: Component type. + :vartype component_type: str + :ivar version: Component version. + :vartype version: str + :ivar ignore_errors: Boolean describing if the component errors are ignores. + :vartype ignore_errors: bool + :ivar init_timeout: Initialization timeout. + :vartype init_timeout: str + :ivar secrets: Collection of secrets used by a Dapr component. + :vartype secrets: list[~azure.mgmt.appcontainers.models.Secret] + :ivar secret_store_component: Name of a Dapr component to retrieve component secrets from. + :vartype secret_store_component: str + :ivar metadata: Component metadata. + :vartype metadata: list[~azure.mgmt.appcontainers.models.DaprMetadata] + :ivar scopes: Names of container apps that can use this Dapr component. + :vartype scopes: list[str] + :ivar service_component_bind: List of container app services that are bound to the Dapr + component. + :vartype service_component_bind: + list[~azure.mgmt.appcontainers.models.DaprComponentServiceBinding] + :ivar provisioning_state: Provisioning state of the Connected Environment Dapr Component. Known + values are: "Succeeded", "Failed", "Canceled", "InProgress", and "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.appcontainers.models.ConnectedEnvironmentDaprComponentProvisioningState + :ivar deployment_errors: Any errors that occurred during deployment or deployment validation. + :vartype deployment_errors: str """ _validation = { @@ -1891,6 +2555,8 @@ class ConnectedEnvironmentStorage(ProxyResource): "name": {"readonly": True}, "type": {"readonly": True}, "system_data": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "deployment_errors": {"readonly": True}, } _attribute_map = { @@ -1898,38 +2564,416 @@ class ConnectedEnvironmentStorage(ProxyResource): "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, "system_data": {"key": "systemData", "type": "SystemData"}, - "properties": {"key": "properties", "type": "ConnectedEnvironmentStorageProperties"}, + "component_type": {"key": "properties.componentType", "type": "str"}, + "version": {"key": "properties.version", "type": "str"}, + "ignore_errors": {"key": "properties.ignoreErrors", "type": "bool"}, + "init_timeout": {"key": "properties.initTimeout", "type": "str"}, + "secrets": {"key": "properties.secrets", "type": "[Secret]"}, + "secret_store_component": {"key": "properties.secretStoreComponent", "type": "str"}, + "metadata": {"key": "properties.metadata", "type": "[DaprMetadata]"}, + "scopes": {"key": "properties.scopes", "type": "[str]"}, + "service_component_bind": {"key": "properties.serviceComponentBind", "type": "[DaprComponentServiceBinding]"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "deployment_errors": {"key": "properties.deploymentErrors", "type": "str"}, } def __init__( - self, *, properties: Optional["_models.ConnectedEnvironmentStorageProperties"] = None, **kwargs: Any + self, + *, + component_type: Optional[str] = None, + version: Optional[str] = None, + ignore_errors: bool = False, + init_timeout: Optional[str] = None, + secrets: Optional[List["_models.Secret"]] = None, + secret_store_component: Optional[str] = None, + metadata: Optional[List["_models.DaprMetadata"]] = None, + scopes: Optional[List[str]] = None, + service_component_bind: Optional[List["_models.DaprComponentServiceBinding"]] = None, + **kwargs: Any ) -> None: """ - :keyword properties: Storage properties. - :paramtype properties: ~azure.mgmt.appcontainers.models.ConnectedEnvironmentStorageProperties + :keyword component_type: Component type. + :paramtype component_type: str + :keyword version: Component version. + :paramtype version: str + :keyword ignore_errors: Boolean describing if the component errors are ignores. + :paramtype ignore_errors: bool + :keyword init_timeout: Initialization timeout. + :paramtype init_timeout: str + :keyword secrets: Collection of secrets used by a Dapr component. + :paramtype secrets: list[~azure.mgmt.appcontainers.models.Secret] + :keyword secret_store_component: Name of a Dapr component to retrieve component secrets from. + :paramtype secret_store_component: str + :keyword metadata: Component metadata. + :paramtype metadata: list[~azure.mgmt.appcontainers.models.DaprMetadata] + :keyword scopes: Names of container apps that can use this Dapr component. + :paramtype scopes: list[str] + :keyword service_component_bind: List of container app services that are bound to the Dapr + component. + :paramtype service_component_bind: + list[~azure.mgmt.appcontainers.models.DaprComponentServiceBinding] """ super().__init__(**kwargs) - self.properties = properties + self.component_type = component_type + self.version = version + self.ignore_errors = ignore_errors + self.init_timeout = init_timeout + self.secrets = secrets + self.secret_store_component = secret_store_component + self.metadata = metadata + self.scopes = scopes + self.service_component_bind = service_component_bind + self.provisioning_state: Optional[Union[str, "_models.ConnectedEnvironmentDaprComponentProvisioningState"]] = ( + None + ) + self.deployment_errors: Optional[str] = None + + +class DaprComponentProperties(_serialization.Model): + """Dapr Component resource specific properties. + + :ivar component_type: Component type. + :vartype component_type: str + :ivar version: Component version. + :vartype version: str + :ivar ignore_errors: Boolean describing if the component errors are ignores. + :vartype ignore_errors: bool + :ivar init_timeout: Initialization timeout. + :vartype init_timeout: str + :ivar secrets: Collection of secrets used by a Dapr component. + :vartype secrets: list[~azure.mgmt.appcontainers.models.Secret] + :ivar secret_store_component: Name of a Dapr component to retrieve component secrets from. + :vartype secret_store_component: str + :ivar metadata: Component metadata. + :vartype metadata: list[~azure.mgmt.appcontainers.models.DaprMetadata] + :ivar scopes: Names of container apps that can use this Dapr component. + :vartype scopes: list[str] + :ivar service_component_bind: List of container app services that are bound to the Dapr + component. + :vartype service_component_bind: + list[~azure.mgmt.appcontainers.models.DaprComponentServiceBinding] + """ + + _attribute_map = { + "component_type": {"key": "componentType", "type": "str"}, + "version": {"key": "version", "type": "str"}, + "ignore_errors": {"key": "ignoreErrors", "type": "bool"}, + "init_timeout": {"key": "initTimeout", "type": "str"}, + "secrets": {"key": "secrets", "type": "[Secret]"}, + "secret_store_component": {"key": "secretStoreComponent", "type": "str"}, + "metadata": {"key": "metadata", "type": "[DaprMetadata]"}, + "scopes": {"key": "scopes", "type": "[str]"}, + "service_component_bind": {"key": "serviceComponentBind", "type": "[DaprComponentServiceBinding]"}, + } + + def __init__( + self, + *, + component_type: Optional[str] = None, + version: Optional[str] = None, + ignore_errors: bool = False, + init_timeout: Optional[str] = None, + secrets: Optional[List["_models.Secret"]] = None, + secret_store_component: Optional[str] = None, + metadata: Optional[List["_models.DaprMetadata"]] = None, + scopes: Optional[List[str]] = None, + service_component_bind: Optional[List["_models.DaprComponentServiceBinding"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword component_type: Component type. + :paramtype component_type: str + :keyword version: Component version. + :paramtype version: str + :keyword ignore_errors: Boolean describing if the component errors are ignores. + :paramtype ignore_errors: bool + :keyword init_timeout: Initialization timeout. + :paramtype init_timeout: str + :keyword secrets: Collection of secrets used by a Dapr component. + :paramtype secrets: list[~azure.mgmt.appcontainers.models.Secret] + :keyword secret_store_component: Name of a Dapr component to retrieve component secrets from. + :paramtype secret_store_component: str + :keyword metadata: Component metadata. + :paramtype metadata: list[~azure.mgmt.appcontainers.models.DaprMetadata] + :keyword scopes: Names of container apps that can use this Dapr component. + :paramtype scopes: list[str] + :keyword service_component_bind: List of container app services that are bound to the Dapr + component. + :paramtype service_component_bind: + list[~azure.mgmt.appcontainers.models.DaprComponentServiceBinding] + """ + super().__init__(**kwargs) + self.component_type = component_type + self.version = version + self.ignore_errors = ignore_errors + self.init_timeout = init_timeout + self.secrets = secrets + self.secret_store_component = secret_store_component + self.metadata = metadata + self.scopes = scopes + self.service_component_bind = service_component_bind + + +class ConnectedEnvironmentDaprComponentProperties(DaprComponentProperties): # pylint: disable=name-too-long + """Dapr component properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar component_type: Component type. + :vartype component_type: str + :ivar version: Component version. + :vartype version: str + :ivar ignore_errors: Boolean describing if the component errors are ignores. + :vartype ignore_errors: bool + :ivar init_timeout: Initialization timeout. + :vartype init_timeout: str + :ivar secrets: Collection of secrets used by a Dapr component. + :vartype secrets: list[~azure.mgmt.appcontainers.models.Secret] + :ivar secret_store_component: Name of a Dapr component to retrieve component secrets from. + :vartype secret_store_component: str + :ivar metadata: Component metadata. + :vartype metadata: list[~azure.mgmt.appcontainers.models.DaprMetadata] + :ivar scopes: Names of container apps that can use this Dapr component. + :vartype scopes: list[str] + :ivar service_component_bind: List of container app services that are bound to the Dapr + component. + :vartype service_component_bind: + list[~azure.mgmt.appcontainers.models.DaprComponentServiceBinding] + :ivar provisioning_state: Provisioning state of the Connected Environment Dapr Component. Known + values are: "Succeeded", "Failed", "Canceled", "InProgress", and "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.appcontainers.models.ConnectedEnvironmentDaprComponentProvisioningState + :ivar deployment_errors: Any errors that occurred during deployment or deployment validation. + :vartype deployment_errors: str + """ + + _validation = { + "provisioning_state": {"readonly": True}, + "deployment_errors": {"readonly": True}, + } + + _attribute_map = { + "component_type": {"key": "componentType", "type": "str"}, + "version": {"key": "version", "type": "str"}, + "ignore_errors": {"key": "ignoreErrors", "type": "bool"}, + "init_timeout": {"key": "initTimeout", "type": "str"}, + "secrets": {"key": "secrets", "type": "[Secret]"}, + "secret_store_component": {"key": "secretStoreComponent", "type": "str"}, + "metadata": {"key": "metadata", "type": "[DaprMetadata]"}, + "scopes": {"key": "scopes", "type": "[str]"}, + "service_component_bind": {"key": "serviceComponentBind", "type": "[DaprComponentServiceBinding]"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "deployment_errors": {"key": "deploymentErrors", "type": "str"}, + } + + def __init__( + self, + *, + component_type: Optional[str] = None, + version: Optional[str] = None, + ignore_errors: bool = False, + init_timeout: Optional[str] = None, + secrets: Optional[List["_models.Secret"]] = None, + secret_store_component: Optional[str] = None, + metadata: Optional[List["_models.DaprMetadata"]] = None, + scopes: Optional[List[str]] = None, + service_component_bind: Optional[List["_models.DaprComponentServiceBinding"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword component_type: Component type. + :paramtype component_type: str + :keyword version: Component version. + :paramtype version: str + :keyword ignore_errors: Boolean describing if the component errors are ignores. + :paramtype ignore_errors: bool + :keyword init_timeout: Initialization timeout. + :paramtype init_timeout: str + :keyword secrets: Collection of secrets used by a Dapr component. + :paramtype secrets: list[~azure.mgmt.appcontainers.models.Secret] + :keyword secret_store_component: Name of a Dapr component to retrieve component secrets from. + :paramtype secret_store_component: str + :keyword metadata: Component metadata. + :paramtype metadata: list[~azure.mgmt.appcontainers.models.DaprMetadata] + :keyword scopes: Names of container apps that can use this Dapr component. + :paramtype scopes: list[str] + :keyword service_component_bind: List of container app services that are bound to the Dapr + component. + :paramtype service_component_bind: + list[~azure.mgmt.appcontainers.models.DaprComponentServiceBinding] + """ + super().__init__( + component_type=component_type, + version=version, + ignore_errors=ignore_errors, + init_timeout=init_timeout, + secrets=secrets, + secret_store_component=secret_store_component, + metadata=metadata, + scopes=scopes, + service_component_bind=service_component_bind, + **kwargs + ) + self.provisioning_state: Optional[Union[str, "_models.ConnectedEnvironmentDaprComponentProvisioningState"]] = ( + None + ) + self.deployment_errors: Optional[str] = None + + +class ConnectedEnvironmentDaprComponentsCollection(_serialization.Model): # pylint: disable=name-too-long + """Collection of Dapr Components for Environments. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar value: Collection of Dapr component resources. Required. + :vartype value: list[~azure.mgmt.appcontainers.models.ConnectedEnvironmentDaprComponent] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[ConnectedEnvironmentDaprComponent]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.ConnectedEnvironmentDaprComponent"], **kwargs: Any) -> None: + """ + :keyword value: Collection of Dapr component resources. Required. + :paramtype value: list[~azure.mgmt.appcontainers.models.ConnectedEnvironmentDaprComponent] + """ + super().__init__(**kwargs) + self.value = value + self.next_link: Optional[str] = None + + +class ResourceTags(_serialization.Model): + """List of key value pairs that describe the resource. This will overwrite the existing tags. + + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + """ + + _attribute_map = { + "tags": {"key": "tags", "type": "{str}"}, + } + + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + """ + super().__init__(**kwargs) + self.tags = tags + + +class ConnectedEnvironmentPatchResource(ResourceTags): + """Connected environment patch properties. + + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + """ + + +class ConnectedEnvironmentStorage(ProxyResource): + """Storage resource for connectedEnvironment. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData + :ivar properties: Storage properties. + :vartype properties: ~azure.mgmt.appcontainers.models.ConnectedEnvironmentStorageProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "properties": {"key": "properties", "type": "ConnectedEnvironmentStorageProperties"}, + } + + def __init__( + self, *, properties: Optional["_models.ConnectedEnvironmentStorageProperties"] = None, **kwargs: Any + ) -> None: + """ + :keyword properties: Storage properties. + :paramtype properties: ~azure.mgmt.appcontainers.models.ConnectedEnvironmentStorageProperties + """ + super().__init__(**kwargs) + self.properties = properties class ConnectedEnvironmentStorageProperties(_serialization.Model): """Storage properties. + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: Provisioning state of the storage. Known values are: "Succeeded", + "Failed", "Canceled", "InProgress", and "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.appcontainers.models.ConnectedEnvironmentStorageProvisioningState + :ivar deployment_errors: Any errors that occurred during deployment or deployment validation. + :vartype deployment_errors: str :ivar azure_file: Azure file properties. :vartype azure_file: ~azure.mgmt.appcontainers.models.AzureFileProperties + :ivar smb: SMB storage properties. + :vartype smb: ~azure.mgmt.appcontainers.models.SmbStorage """ + _validation = { + "provisioning_state": {"readonly": True}, + "deployment_errors": {"readonly": True}, + } + _attribute_map = { + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "deployment_errors": {"key": "deploymentErrors", "type": "str"}, "azure_file": {"key": "azureFile", "type": "AzureFileProperties"}, + "smb": {"key": "smb", "type": "SmbStorage"}, } - def __init__(self, *, azure_file: Optional["_models.AzureFileProperties"] = None, **kwargs: Any) -> None: + def __init__( + self, + *, + azure_file: Optional["_models.AzureFileProperties"] = None, + smb: Optional["_models.SmbStorage"] = None, + **kwargs: Any + ) -> None: """ :keyword azure_file: Azure file properties. :paramtype azure_file: ~azure.mgmt.appcontainers.models.AzureFileProperties + :keyword smb: SMB storage properties. + :paramtype smb: ~azure.mgmt.appcontainers.models.SmbStorage """ super().__init__(**kwargs) + self.provisioning_state: Optional[Union[str, "_models.ConnectedEnvironmentStorageProvisioningState"]] = None + self.deployment_errors: Optional[str] = None self.azure_file = azure_file + self.smb = smb class ConnectedEnvironmentStoragesCollection(_serialization.Model): @@ -1963,6 +3007,10 @@ class Container(BaseContainer): :ivar image: Container image tag. :vartype image: str + :ivar image_type: The type of the image. Set to CloudBuild to let the system manages the image, + where user will not be able to update image through image field. Set to ContainerImage for user + provided image. Known values are: "CloudBuild" and "ContainerImage". + :vartype image_type: str or ~azure.mgmt.appcontainers.models.ImageType :ivar name: Custom container name. :vartype name: str :ivar command: Container start command. @@ -1981,6 +3029,7 @@ class Container(BaseContainer): _attribute_map = { "image": {"key": "image", "type": "str"}, + "image_type": {"key": "imageType", "type": "str"}, "name": {"key": "name", "type": "str"}, "command": {"key": "command", "type": "[str]"}, "args": {"key": "args", "type": "[str]"}, @@ -1994,6 +3043,7 @@ def __init__( self, *, image: Optional[str] = None, + image_type: Optional[Union[str, "_models.ImageType"]] = None, name: Optional[str] = None, command: Optional[List[str]] = None, args: Optional[List[str]] = None, @@ -2006,6 +3056,10 @@ def __init__( """ :keyword image: Container image tag. :paramtype image: str + :keyword image_type: The type of the image. Set to CloudBuild to let the system manages the + image, where user will not be able to update image through image field. Set to ContainerImage + for user provided image. Known values are: "CloudBuild" and "ContainerImage". + :paramtype image_type: str or ~azure.mgmt.appcontainers.models.ImageType :keyword name: Custom container name. :paramtype name: str :keyword command: Container start command. @@ -2023,6 +3077,7 @@ def __init__( """ super().__init__( image=image, + image_type=image_type, name=name, command=command, args=args, @@ -2042,7 +3097,7 @@ class ContainerApp(TrackedResource): All required parameters must be populated in order to send to server. :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -2066,6 +3121,10 @@ class ContainerApp(TrackedResource): mode deployment will not delete the resource if it is removed from the template since it is managed by another resource. :vartype managed_by: str + :ivar kind: Metadata used to render different experiences for resources of the same type; e.g. + WorkflowApp is a kind of Microsoft.App/ContainerApps type. If supported, the resource provider + must validate and persist this value. "workflowapp" + :vartype kind: str or ~azure.mgmt.appcontainers.models.Kind :ivar provisioning_state: Provisioning state of the Container App. Known values are: "InProgress", "Succeeded", "Failed", "Canceled", and "Deleting". :vartype provisioning_state: str or @@ -2073,12 +3132,17 @@ class ContainerApp(TrackedResource): :ivar running_status: Running status of the Container App. Known values are: "Progressing", "Running", "Stopped", "Suspended", and "Ready". :vartype running_status: str or ~azure.mgmt.appcontainers.models.ContainerAppRunningStatus + :ivar deployment_errors: Any errors that occurred during deployment. + :vartype deployment_errors: str :ivar managed_environment_id: Deprecated. Resource ID of the Container App's environment. :vartype managed_environment_id: str :ivar environment_id: Resource ID of environment. :vartype environment_id: str :ivar workload_profile_name: Workload profile name to pin for container app execution. :vartype workload_profile_name: str + :ivar patching_configuration: Container App auto patch configuration. + :vartype patching_configuration: + ~azure.mgmt.appcontainers.models.ContainerAppPropertiesPatchingConfiguration :ivar latest_revision_name: Name of the latest revision of the Container App. :vartype latest_revision_name: str :ivar latest_ready_revision_name: Name of the latest ready revision of the Container App. @@ -2106,6 +3170,7 @@ class ContainerApp(TrackedResource): "location": {"required": True}, "provisioning_state": {"readonly": True}, "running_status": {"readonly": True}, + "deployment_errors": {"readonly": True}, "latest_revision_name": {"readonly": True}, "latest_ready_revision_name": {"readonly": True}, "latest_revision_fqdn": {"readonly": True}, @@ -2124,11 +3189,17 @@ class ContainerApp(TrackedResource): "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, "managed_by": {"key": "managedBy", "type": "str"}, + "kind": {"key": "kind", "type": "str"}, "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, "running_status": {"key": "properties.runningStatus", "type": "str"}, + "deployment_errors": {"key": "properties.deploymentErrors", "type": "str"}, "managed_environment_id": {"key": "properties.managedEnvironmentId", "type": "str"}, "environment_id": {"key": "properties.environmentId", "type": "str"}, "workload_profile_name": {"key": "properties.workloadProfileName", "type": "str"}, + "patching_configuration": { + "key": "properties.patchingConfiguration", + "type": "ContainerAppPropertiesPatchingConfiguration", + }, "latest_revision_name": {"key": "properties.latestRevisionName", "type": "str"}, "latest_ready_revision_name": {"key": "properties.latestReadyRevisionName", "type": "str"}, "latest_revision_fqdn": {"key": "properties.latestRevisionFqdn", "type": "str"}, @@ -2139,7 +3210,7 @@ class ContainerApp(TrackedResource): "event_stream_endpoint": {"key": "properties.eventStreamEndpoint", "type": "str"}, } - def __init__( + def __init__( # pylint: disable=too-many-locals self, *, location: str, @@ -2147,9 +3218,11 @@ def __init__( extended_location: Optional["_models.ExtendedLocation"] = None, identity: Optional["_models.ManagedServiceIdentity"] = None, managed_by: Optional[str] = None, + kind: Optional[Union[str, "_models.Kind"]] = None, managed_environment_id: Optional[str] = None, environment_id: Optional[str] = None, workload_profile_name: Optional[str] = None, + patching_configuration: Optional["_models.ContainerAppPropertiesPatchingConfiguration"] = None, configuration: Optional["_models.Configuration"] = None, template: Optional["_models.Template"] = None, **kwargs: Any @@ -2169,12 +3242,19 @@ def __init__( complete mode deployment will not delete the resource if it is removed from the template since it is managed by another resource. :paramtype managed_by: str + :keyword kind: Metadata used to render different experiences for resources of the same type; + e.g. WorkflowApp is a kind of Microsoft.App/ContainerApps type. If supported, the resource + provider must validate and persist this value. "workflowapp" + :paramtype kind: str or ~azure.mgmt.appcontainers.models.Kind :keyword managed_environment_id: Deprecated. Resource ID of the Container App's environment. :paramtype managed_environment_id: str :keyword environment_id: Resource ID of environment. :paramtype environment_id: str :keyword workload_profile_name: Workload profile name to pin for container app execution. :paramtype workload_profile_name: str + :keyword patching_configuration: Container App auto patch configuration. + :paramtype patching_configuration: + ~azure.mgmt.appcontainers.models.ContainerAppPropertiesPatchingConfiguration :keyword configuration: Non versioned Container App configuration properties. :paramtype configuration: ~azure.mgmt.appcontainers.models.Configuration :keyword template: Container App versioned application definition. @@ -2184,19 +3264,22 @@ def __init__( self.extended_location = extended_location self.identity = identity self.managed_by = managed_by - self.provisioning_state = None - self.running_status = None + self.kind = kind + self.provisioning_state: Optional[Union[str, "_models.ContainerAppProvisioningState"]] = None + self.running_status: Optional[Union[str, "_models.ContainerAppRunningStatus"]] = None + self.deployment_errors: Optional[str] = None self.managed_environment_id = managed_environment_id self.environment_id = environment_id self.workload_profile_name = workload_profile_name - self.latest_revision_name = None - self.latest_ready_revision_name = None - self.latest_revision_fqdn = None - self.custom_domain_verification_id = None + self.patching_configuration = patching_configuration + self.latest_revision_name: Optional[str] = None + self.latest_ready_revision_name: Optional[str] = None + self.latest_revision_fqdn: Optional[str] = None + self.custom_domain_verification_id: Optional[str] = None self.configuration = configuration self.template = template - self.outbound_ip_addresses = None - self.event_stream_endpoint = None + self.outbound_ip_addresses: Optional[List[str]] = None + self.event_stream_endpoint: Optional[str] = None class ContainerAppAuthToken(TrackedResource): @@ -2207,7 +3290,7 @@ class ContainerAppAuthToken(TrackedResource): All required parameters must be populated in order to send to server. :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -2256,8 +3339,8 @@ def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kw :paramtype location: str """ super().__init__(tags=tags, location=location, **kwargs) - self.token = None - self.expires = None + self.token: Optional[str] = None + self.expires: Optional[datetime.datetime] = None class ContainerAppCollection(_serialization.Model): @@ -2290,7 +3373,7 @@ def __init__(self, *, value: List["_models.ContainerApp"], **kwargs: Any) -> Non """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class ContainerAppJobExecutions(_serialization.Model): @@ -2323,7 +3406,7 @@ def __init__(self, *, value: List["_models.JobExecution"], **kwargs: Any) -> Non """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class ContainerAppProbe(_serialization.Model): @@ -2572,6 +3655,179 @@ def __init__(self, *, port: int, host: Optional[str] = None, **kwargs: Any) -> N self.port = port +class ContainerAppPropertiesPatchingConfiguration(_serialization.Model): # pylint: disable=name-too-long + """Container App auto patch configuration. + + :ivar patching_mode: Patching mode for the container app. Null or default in this field will be + interpreted as Automatic by RP. Automatic mode will automatically apply available patches. + Manual mode will require the user to manually apply patches. Disabled mode will stop patch + detection and auto patching. Known values are: "Automatic", "Manual", and "Disabled". + :vartype patching_mode: str or ~azure.mgmt.appcontainers.models.PatchingMode + """ + + _attribute_map = { + "patching_mode": {"key": "patchingMode", "type": "str"}, + } + + def __init__(self, *, patching_mode: Optional[Union[str, "_models.PatchingMode"]] = None, **kwargs: Any) -> None: + """ + :keyword patching_mode: Patching mode for the container app. Null or default in this field will + be interpreted as Automatic by RP. Automatic mode will automatically apply available patches. + Manual mode will require the user to manually apply patches. Disabled mode will stop patch + detection and auto patching. Known values are: "Automatic", "Manual", and "Disabled". + :paramtype patching_mode: str or ~azure.mgmt.appcontainers.models.PatchingMode + """ + super().__init__(**kwargs) + self.patching_mode = patching_mode + + +class ContainerAppsBuildCollection(_serialization.Model): + """The response of a Container Apps Build Resource list operation. + + All required parameters must be populated in order to send to server. + + :ivar value: The Container Apps Build Resource items on this page. Required. + :vartype value: list[~azure.mgmt.appcontainers.models.ContainerAppsBuildResource] + :ivar next_link: The link to the next page of items. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[ContainerAppsBuildResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: List["_models.ContainerAppsBuildResource"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The Container Apps Build Resource items on this page. Required. + :paramtype value: list[~azure.mgmt.appcontainers.models.ContainerAppsBuildResource] + :keyword next_link: The link to the next page of items. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ContainerAppsBuildConfiguration(_serialization.Model): + """Configuration of the build. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar base_os: Base OS used to build and run the app. + :vartype base_os: str + :ivar platform: Platform to be used to build and run the app. + :vartype platform: str + :ivar platform_version: Platform version to be used to build and run the app. + :vartype platform_version: str + :ivar environment_variables: List of environment variables to be passed to the build, secrets + should not be used in environment variable. + :vartype environment_variables: list[~azure.mgmt.appcontainers.models.EnvironmentVariable] + :ivar pre_build_steps: List of steps to perform before the build. + :vartype pre_build_steps: list[~azure.mgmt.appcontainers.models.PreBuildStep] + """ + + _validation = { + "base_os": {"readonly": True}, + "platform": {"readonly": True}, + "platform_version": {"readonly": True}, + "environment_variables": {"readonly": True}, + "pre_build_steps": {"readonly": True}, + } + + _attribute_map = { + "base_os": {"key": "baseOs", "type": "str"}, + "platform": {"key": "platform", "type": "str"}, + "platform_version": {"key": "platformVersion", "type": "str"}, + "environment_variables": {"key": "environmentVariables", "type": "[EnvironmentVariable]"}, + "pre_build_steps": {"key": "preBuildSteps", "type": "[PreBuildStep]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.base_os: Optional[str] = None + self.platform: Optional[str] = None + self.platform_version: Optional[str] = None + self.environment_variables: Optional[List["_models.EnvironmentVariable"]] = None + self.pre_build_steps: Optional[List["_models.PreBuildStep"]] = None + + +class ContainerAppsBuildResource(ProxyResource): + """Information pertaining to an individual build. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData + :ivar provisioning_state: Build provisioning state. Known values are: "Succeeded", "Failed", + "Canceled", "Creating", "Updating", and "Deleting". + :vartype provisioning_state: str or ~azure.mgmt.appcontainers.models.BuildProvisioningState + :ivar build_status: Status of the build once it has been provisioned. Known values are: + "NotStarted", "InProgress", "Succeeded", "Canceled", and "Failed". + :vartype build_status: str or ~azure.mgmt.appcontainers.models.BuildStatus + :ivar destination_container_registry: Container registry that the final image will be uploaded + to. + :vartype destination_container_registry: + ~azure.mgmt.appcontainers.models.ContainerRegistryWithCustomImage + :ivar configuration: Configuration of the build. + :vartype configuration: ~azure.mgmt.appcontainers.models.ContainerAppsBuildConfiguration + :ivar log_stream_endpoint: Endpoint from which the build logs can be streamed. + :vartype log_stream_endpoint: str + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "build_status": {"readonly": True}, + "destination_container_registry": {"readonly": True}, + "configuration": {"readonly": True}, + "log_stream_endpoint": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "build_status": {"key": "properties.buildStatus", "type": "str"}, + "destination_container_registry": { + "key": "properties.destinationContainerRegistry", + "type": "ContainerRegistryWithCustomImage", + }, + "configuration": {"key": "properties.configuration", "type": "ContainerAppsBuildConfiguration"}, + "log_stream_endpoint": {"key": "properties.logStreamEndpoint", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.provisioning_state: Optional[Union[str, "_models.BuildProvisioningState"]] = None + self.build_status: Optional[Union[str, "_models.BuildStatus"]] = None + self.destination_container_registry: Optional["_models.ContainerRegistryWithCustomImage"] = None + self.configuration: Optional["_models.ContainerAppsBuildConfiguration"] = None + self.log_stream_endpoint: Optional[str] = None + + class ContainerAppSecret(_serialization.Model): """Container App Secret. @@ -2606,10 +3862,169 @@ class ContainerAppSecret(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.name = None - self.value = None - self.identity = None - self.key_vault_url = None + self.name: Optional[str] = None + self.value: Optional[str] = None + self.identity: Optional[str] = None + self.key_vault_url: Optional[str] = None + + +class ContainerAppsPatchResource(ProxyResource): + """Container App Patch. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData + :ivar properties: Properties that describes current states of the patch resource. + :vartype properties: ~azure.mgmt.appcontainers.models.PatchProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "properties": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "properties": {"key": "properties", "type": "PatchProperties"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.properties: Optional["_models.PatchProperties"] = None + + +class ContainerExecutionStatus(_serialization.Model): + """Container Apps Job execution container status. Contains status code and reason. + + :ivar name: Container Name. + :vartype name: str + :ivar code: Exit code. + :vartype code: int + :ivar additional_information: Additional information for the container status. + :vartype additional_information: str + :ivar status: Status of the container. + :vartype status: str + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "code": {"key": "code", "type": "int"}, + "additional_information": {"key": "additionalInformation", "type": "str"}, + "status": {"key": "status", "type": "str"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + code: Optional[int] = None, + additional_information: Optional[str] = None, + status: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: Container Name. + :paramtype name: str + :keyword code: Exit code. + :paramtype code: int + :keyword additional_information: Additional information for the container status. + :paramtype additional_information: str + :keyword status: Status of the container. + :paramtype status: str + """ + super().__init__(**kwargs) + self.name = name + self.code = code + self.additional_information = additional_information + self.status = status + + +class ContainerRegistry(_serialization.Model): + """Model representing a mapping from a container registry to the identity used to connect to it. + + All required parameters must be populated in order to send to server. + + :ivar container_registry_server: Login server of the container registry. Required. + :vartype container_registry_server: str + :ivar identity_resource_id: Resource ID of the managed identity. Required. + :vartype identity_resource_id: str + """ + + _validation = { + "container_registry_server": {"required": True}, + "identity_resource_id": {"required": True}, + } + + _attribute_map = { + "container_registry_server": {"key": "containerRegistryServer", "type": "str"}, + "identity_resource_id": {"key": "identityResourceId", "type": "str"}, + } + + def __init__(self, *, container_registry_server: str, identity_resource_id: str, **kwargs: Any) -> None: + """ + :keyword container_registry_server: Login server of the container registry. Required. + :paramtype container_registry_server: str + :keyword identity_resource_id: Resource ID of the managed identity. Required. + :paramtype identity_resource_id: str + """ + super().__init__(**kwargs) + self.container_registry_server = container_registry_server + self.identity_resource_id = identity_resource_id + + +class ContainerRegistryWithCustomImage(_serialization.Model): + """Container registry that the final image will be uploaded to. + + All required parameters must be populated in order to send to server. + + :ivar server: Login server of the container registry that the final image should be uploaded + to. Builder resource needs to have this container registry defined along with an identity to + use to access it. Required. + :vartype server: str + :ivar image: Full name that the final image should be uploaded as, including both image name + and tag. + :vartype image: str + """ + + _validation = { + "server": {"required": True}, + } + + _attribute_map = { + "server": {"key": "server", "type": "str"}, + "image": {"key": "image", "type": "str"}, + } + + def __init__(self, *, server: str, image: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword server: Login server of the container registry that the final image should be uploaded + to. Builder resource needs to have this container registry defined along with an identity to + use to access it. Required. + :paramtype server: str + :keyword image: Full name that the final image should be uploaded as, including both image name + and tag. + :paramtype image: str + """ + super().__init__(**kwargs) + self.server = server + self.image = image class ContainerResources(_serialization.Model): @@ -2623,6 +4038,8 @@ class ContainerResources(_serialization.Model): :vartype memory: str :ivar ephemeral_storage: Ephemeral Storage, e.g. "1Gi". :vartype ephemeral_storage: str + :ivar gpu: Required GPU in cores for GPU based app, e.g. 1.0. + :vartype gpu: float """ _validation = { @@ -2633,19 +4050,25 @@ class ContainerResources(_serialization.Model): "cpu": {"key": "cpu", "type": "float"}, "memory": {"key": "memory", "type": "str"}, "ephemeral_storage": {"key": "ephemeralStorage", "type": "str"}, + "gpu": {"key": "gpu", "type": "float"}, } - def __init__(self, *, cpu: Optional[float] = None, memory: Optional[str] = None, **kwargs: Any) -> None: + def __init__( + self, *, cpu: Optional[float] = None, memory: Optional[str] = None, gpu: Optional[float] = None, **kwargs: Any + ) -> None: """ :keyword cpu: Required CPU in cores, e.g. 0.5. :paramtype cpu: float :keyword memory: Required memory, e.g. "250Mb". :paramtype memory: str + :keyword gpu: Required GPU in cores for GPU based app, e.g. 1.0. + :paramtype gpu: float """ super().__init__(**kwargs) self.cpu = cpu self.memory = memory - self.ephemeral_storage = None + self.ephemeral_storage: Optional[str] = None + self.gpu = gpu class CookieExpiration(_serialization.Model): @@ -2800,7 +4223,8 @@ class CustomDomain(_serialization.Model): :ivar name: Hostname. Required. :vartype name: str - :ivar binding_type: Custom Domain binding type. Known values are: "Disabled" and "SniEnabled". + :ivar binding_type: Custom Domain binding type. Known values are: "Disabled", "SniEnabled", and + "Auto". :vartype binding_type: str or ~azure.mgmt.appcontainers.models.BindingType :ivar certificate_id: Resource Id of the Certificate to be bound to this hostname. Must exist in the Managed Environment. @@ -2828,8 +4252,8 @@ def __init__( """ :keyword name: Hostname. Required. :paramtype name: str - :keyword binding_type: Custom Domain binding type. Known values are: "Disabled" and - "SniEnabled". + :keyword binding_type: Custom Domain binding type. Known values are: "Disabled", "SniEnabled", + and "Auto". :paramtype binding_type: str or ~azure.mgmt.appcontainers.models.BindingType :keyword certificate_id: Resource Id of the Certificate to be bound to this hostname. Must exist in the Managed Environment. @@ -2907,14 +4331,14 @@ def __init__( :paramtype certificate_password: str """ super().__init__(**kwargs) - self.custom_domain_verification_id = None + self.custom_domain_verification_id: Optional[str] = None self.dns_suffix = dns_suffix self.certificate_key_vault_properties = certificate_key_vault_properties self.certificate_value = certificate_value self.certificate_password = certificate_password - self.expiration_date = None - self.thumbprint = None - self.subject_name = None + self.expiration_date: Optional[datetime.datetime] = None + self.thumbprint: Optional[str] = None + self.subject_name: Optional[str] = None class CustomHostnameAnalysisResult(_serialization.Model): @@ -3008,13 +4432,15 @@ def __init__( :paramtype alternate_txt_records: list[str] """ super().__init__(**kwargs) - self.host_name = None - self.is_hostname_already_verified = None - self.custom_domain_verification_test = None - self.custom_domain_verification_failure_info = None - self.has_conflict_on_managed_environment = None - self.conflict_with_environment_custom_domain = None - self.conflicting_container_app_resource_id = None + self.host_name: Optional[str] = None + self.is_hostname_already_verified: Optional[bool] = None + self.custom_domain_verification_test: Optional[Union[str, "_models.DnsVerificationTestResult"]] = None + self.custom_domain_verification_failure_info: Optional[ + "_models.CustomHostnameAnalysisResultCustomDomainVerificationFailureInfo" + ] = None + self.has_conflict_on_managed_environment: Optional[bool] = None + self.conflict_with_environment_custom_domain: Optional[bool] = None + self.conflicting_container_app_resource_id: Optional[str] = None self.c_name_records = c_name_records self.txt_records = txt_records self.a_records = a_records @@ -3067,12 +4493,12 @@ def __init__( """ :keyword details: Details or the error. :paramtype details: - list[~azure.mgmt.appcontainers.models.CustomHostnameAnalysisResultCustomDomainVerificationFailureInfoDetailsItem] # pylint: disable=line-too-long + list[~azure.mgmt.appcontainers.models.CustomHostnameAnalysisResultCustomDomainVerificationFailureInfoDetailsItem] """ super().__init__(**kwargs) - self.code = None - self.message = None - self.target = None + self.code: Optional[str] = None + self.message: Optional[str] = None + self.target: Optional[str] = None self.details = details @@ -3106,9 +4532,9 @@ class CustomHostnameAnalysisResultCustomDomainVerificationFailureInfoDetailsItem def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.code = None - self.message = None - self.target = None + self.code: Optional[str] = None + self.message: Optional[str] = None + self.target: Optional[str] = None class CustomOpenIdConnectProvider(_serialization.Model): @@ -3229,6 +4655,11 @@ class Dapr(_serialization.Model): :vartype log_level: str or ~azure.mgmt.appcontainers.models.LogLevel :ivar enable_api_logging: Enables API logging for the Dapr sidecar. :vartype enable_api_logging: bool + :ivar app_health: Dapr application health check configuration. + :vartype app_health: ~azure.mgmt.appcontainers.models.DaprAppHealth + :ivar max_concurrency: Maximum number of concurrent requests, events handled by the Dapr + sidecar. + :vartype max_concurrency: int """ _attribute_map = { @@ -3240,6 +4671,8 @@ class Dapr(_serialization.Model): "http_max_request_size": {"key": "httpMaxRequestSize", "type": "int"}, "log_level": {"key": "logLevel", "type": "str"}, "enable_api_logging": {"key": "enableApiLogging", "type": "bool"}, + "app_health": {"key": "appHealth", "type": "DaprAppHealth"}, + "max_concurrency": {"key": "maxConcurrency", "type": "int"}, } def __init__( @@ -3253,6 +4686,8 @@ def __init__( http_max_request_size: Optional[int] = None, log_level: Optional[Union[str, "_models.LogLevel"]] = None, enable_api_logging: Optional[bool] = None, + app_health: Optional["_models.DaprAppHealth"] = None, + max_concurrency: Optional[int] = None, **kwargs: Any ) -> None: """ @@ -3276,6 +4711,11 @@ def __init__( :paramtype log_level: str or ~azure.mgmt.appcontainers.models.LogLevel :keyword enable_api_logging: Enables API logging for the Dapr sidecar. :paramtype enable_api_logging: bool + :keyword app_health: Dapr application health check configuration. + :paramtype app_health: ~azure.mgmt.appcontainers.models.DaprAppHealth + :keyword max_concurrency: Maximum number of concurrent requests, events handled by the Dapr + sidecar. + :paramtype max_concurrency: int """ super().__init__(**kwargs) self.enabled = enabled @@ -3286,6 +4726,67 @@ def __init__( self.http_max_request_size = http_max_request_size self.log_level = log_level self.enable_api_logging = enable_api_logging + self.app_health = app_health + self.max_concurrency = max_concurrency + + +class DaprAppHealth(_serialization.Model): + """Dapr application health check configuration. + + :ivar enabled: Boolean indicating if the health probe is enabled. + :vartype enabled: bool + :ivar path: Path for the health probe. + :vartype path: str + :ivar probe_interval_seconds: Interval for the health probe in seconds. + :vartype probe_interval_seconds: int + :ivar probe_timeout_milliseconds: Timeout for the health probe in milliseconds. + :vartype probe_timeout_milliseconds: int + :ivar threshold: Threshold for the health probe. + :vartype threshold: int + """ + + _validation = { + "probe_interval_seconds": {"minimum": 1}, + "probe_timeout_milliseconds": {"minimum": 1}, + "threshold": {"minimum": 1}, + } + + _attribute_map = { + "enabled": {"key": "enabled", "type": "bool"}, + "path": {"key": "path", "type": "str"}, + "probe_interval_seconds": {"key": "probeIntervalSeconds", "type": "int"}, + "probe_timeout_milliseconds": {"key": "probeTimeoutMilliseconds", "type": "int"}, + "threshold": {"key": "threshold", "type": "int"}, + } + + def __init__( + self, + *, + enabled: Optional[bool] = None, + path: Optional[str] = None, + probe_interval_seconds: Optional[int] = None, + probe_timeout_milliseconds: Optional[int] = None, + threshold: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword enabled: Boolean indicating if the health probe is enabled. + :paramtype enabled: bool + :keyword path: Path for the health probe. + :paramtype path: str + :keyword probe_interval_seconds: Interval for the health probe in seconds. + :paramtype probe_interval_seconds: int + :keyword probe_timeout_milliseconds: Timeout for the health probe in milliseconds. + :paramtype probe_timeout_milliseconds: int + :keyword threshold: Threshold for the health probe. + :paramtype threshold: int + """ + super().__init__(**kwargs) + self.enabled = enabled + self.path = path + self.probe_interval_seconds = probe_interval_seconds + self.probe_timeout_milliseconds = probe_timeout_milliseconds + self.threshold = threshold class DaprComponent(ProxyResource): @@ -3294,7 +4795,7 @@ class DaprComponent(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -3320,6 +4821,10 @@ class DaprComponent(ProxyResource): :vartype metadata: list[~azure.mgmt.appcontainers.models.DaprMetadata] :ivar scopes: Names of container apps that can use this Dapr component. :vartype scopes: list[str] + :ivar service_component_bind: List of container app services that are bound to the Dapr + component. + :vartype service_component_bind: + list[~azure.mgmt.appcontainers.models.DaprComponentServiceBinding] """ _validation = { @@ -3342,6 +4847,7 @@ class DaprComponent(ProxyResource): "secret_store_component": {"key": "properties.secretStoreComponent", "type": "str"}, "metadata": {"key": "properties.metadata", "type": "[DaprMetadata]"}, "scopes": {"key": "properties.scopes", "type": "[str]"}, + "service_component_bind": {"key": "properties.serviceComponentBind", "type": "[DaprComponentServiceBinding]"}, } def __init__( @@ -3355,6 +4861,7 @@ def __init__( secret_store_component: Optional[str] = None, metadata: Optional[List["_models.DaprMetadata"]] = None, scopes: Optional[List[str]] = None, + service_component_bind: Optional[List["_models.DaprComponentServiceBinding"]] = None, **kwargs: Any ) -> None: """ @@ -3374,6 +4881,10 @@ def __init__( :paramtype metadata: list[~azure.mgmt.appcontainers.models.DaprMetadata] :keyword scopes: Names of container apps that can use this Dapr component. :paramtype scopes: list[str] + :keyword service_component_bind: List of container app services that are bound to the Dapr + component. + :paramtype service_component_bind: + list[~azure.mgmt.appcontainers.models.DaprComponentServiceBinding] """ super().__init__(**kwargs) self.component_type = component_type @@ -3384,17 +4895,18 @@ def __init__( self.secret_store_component = secret_store_component self.metadata = metadata self.scopes = scopes + self.service_component_bind = service_component_bind -class DaprComponentsCollection(_serialization.Model): - """Dapr Components ARM resource. +class DaprComponentResiliencyPoliciesCollection(_serialization.Model): # pylint: disable=name-too-long + """Dapr Component Resiliency Policies ARM resource. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to server. :ivar value: Collection of resources. Required. - :vartype value: list[~azure.mgmt.appcontainers.models.DaprComponent] + :vartype value: list[~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicy] :ivar next_link: Link to next page of resources. :vartype next_link: str """ @@ -3405,41 +4917,363 @@ class DaprComponentsCollection(_serialization.Model): } _attribute_map = { - "value": {"key": "value", "type": "[DaprComponent]"}, + "value": {"key": "value", "type": "[DaprComponentResiliencyPolicy]"}, "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: List["_models.DaprComponent"], **kwargs: Any) -> None: + def __init__(self, *, value: List["_models.DaprComponentResiliencyPolicy"], **kwargs: Any) -> None: """ :keyword value: Collection of resources. Required. - :paramtype value: list[~azure.mgmt.appcontainers.models.DaprComponent] + :paramtype value: list[~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicy] """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None -class DaprConfiguration(_serialization.Model): - """Configuration properties Dapr component. +class DaprComponentResiliencyPolicy(ProxyResource): + """Dapr Component Resiliency Policy. Variables are only populated by the server, and will be ignored when sending a request. - :ivar version: The version of Dapr. - :vartype version: str + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData + :ivar inbound_policy: The optional inbound component resiliency policy configuration. + :vartype inbound_policy: + ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicyConfiguration + :ivar outbound_policy: The optional outbound component resiliency policy configuration. + :vartype outbound_policy: + ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicyConfiguration """ _validation = { - "version": {"readonly": True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, } _attribute_map = { - "version": {"key": "version", "type": "str"}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "inbound_policy": {"key": "properties.inboundPolicy", "type": "DaprComponentResiliencyPolicyConfiguration"}, + "outbound_policy": {"key": "properties.outboundPolicy", "type": "DaprComponentResiliencyPolicyConfiguration"}, } - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.version = None + def __init__( + self, + *, + inbound_policy: Optional["_models.DaprComponentResiliencyPolicyConfiguration"] = None, + outbound_policy: Optional["_models.DaprComponentResiliencyPolicyConfiguration"] = None, + **kwargs: Any + ) -> None: + """ + :keyword inbound_policy: The optional inbound component resiliency policy configuration. + :paramtype inbound_policy: + ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicyConfiguration + :keyword outbound_policy: The optional outbound component resiliency policy configuration. + :paramtype outbound_policy: + ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicyConfiguration + """ + super().__init__(**kwargs) + self.inbound_policy = inbound_policy + self.outbound_policy = outbound_policy + + +class DaprComponentResiliencyPolicyCircuitBreakerPolicyConfiguration( + _serialization.Model +): # pylint: disable=name-too-long + """Dapr Component Resiliency Policy Circuit Breaker Policy Configuration. + + :ivar consecutive_errors: The number of consecutive errors before the circuit is opened. + :vartype consecutive_errors: int + :ivar timeout_in_seconds: The interval in seconds until a retry attempt is made after the + circuit is opened. + :vartype timeout_in_seconds: int + :ivar interval_in_seconds: The optional interval in seconds after which the error count resets + to 0. An interval of 0 will never reset. If not specified, the timeoutInSeconds value will be + used. + :vartype interval_in_seconds: int + """ + + _attribute_map = { + "consecutive_errors": {"key": "consecutiveErrors", "type": "int"}, + "timeout_in_seconds": {"key": "timeoutInSeconds", "type": "int"}, + "interval_in_seconds": {"key": "intervalInSeconds", "type": "int"}, + } + + def __init__( + self, + *, + consecutive_errors: Optional[int] = None, + timeout_in_seconds: Optional[int] = None, + interval_in_seconds: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword consecutive_errors: The number of consecutive errors before the circuit is opened. + :paramtype consecutive_errors: int + :keyword timeout_in_seconds: The interval in seconds until a retry attempt is made after the + circuit is opened. + :paramtype timeout_in_seconds: int + :keyword interval_in_seconds: The optional interval in seconds after which the error count + resets to 0. An interval of 0 will never reset. If not specified, the timeoutInSeconds value + will be used. + :paramtype interval_in_seconds: int + """ + super().__init__(**kwargs) + self.consecutive_errors = consecutive_errors + self.timeout_in_seconds = timeout_in_seconds + self.interval_in_seconds = interval_in_seconds + + +class DaprComponentResiliencyPolicyConfiguration(_serialization.Model): # pylint: disable=name-too-long + """Dapr Component Resiliency Policy Configuration. + + :ivar http_retry_policy: The optional HTTP retry policy configuration. + :vartype http_retry_policy: + ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicyHttpRetryPolicyConfiguration + :ivar timeout_policy: The optional timeout policy configuration. + :vartype timeout_policy: + ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicyTimeoutPolicyConfiguration + :ivar circuit_breaker_policy: The optional circuit breaker policy configuration. + :vartype circuit_breaker_policy: + ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicyCircuitBreakerPolicyConfiguration + """ + + _attribute_map = { + "http_retry_policy": { + "key": "httpRetryPolicy", + "type": "DaprComponentResiliencyPolicyHttpRetryPolicyConfiguration", + }, + "timeout_policy": {"key": "timeoutPolicy", "type": "DaprComponentResiliencyPolicyTimeoutPolicyConfiguration"}, + "circuit_breaker_policy": { + "key": "circuitBreakerPolicy", + "type": "DaprComponentResiliencyPolicyCircuitBreakerPolicyConfiguration", + }, + } + + def __init__( + self, + *, + http_retry_policy: Optional["_models.DaprComponentResiliencyPolicyHttpRetryPolicyConfiguration"] = None, + timeout_policy: Optional["_models.DaprComponentResiliencyPolicyTimeoutPolicyConfiguration"] = None, + circuit_breaker_policy: Optional[ + "_models.DaprComponentResiliencyPolicyCircuitBreakerPolicyConfiguration" + ] = None, + **kwargs: Any + ) -> None: + """ + :keyword http_retry_policy: The optional HTTP retry policy configuration. + :paramtype http_retry_policy: + ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicyHttpRetryPolicyConfiguration + :keyword timeout_policy: The optional timeout policy configuration. + :paramtype timeout_policy: + ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicyTimeoutPolicyConfiguration + :keyword circuit_breaker_policy: The optional circuit breaker policy configuration. + :paramtype circuit_breaker_policy: + ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicyCircuitBreakerPolicyConfiguration + """ + super().__init__(**kwargs) + self.http_retry_policy = http_retry_policy + self.timeout_policy = timeout_policy + self.circuit_breaker_policy = circuit_breaker_policy + + +class DaprComponentResiliencyPolicyHttpRetryBackOffConfiguration(_serialization.Model): # pylint: disable=name-too-long + """Dapr Component Resiliency Policy HTTP Retry Backoff Configuration. + + :ivar initial_delay_in_milliseconds: The optional initial delay in milliseconds before an + operation is retried. + :vartype initial_delay_in_milliseconds: int + :ivar max_interval_in_milliseconds: The optional maximum time interval in milliseconds between + retry attempts. + :vartype max_interval_in_milliseconds: int + """ + + _attribute_map = { + "initial_delay_in_milliseconds": {"key": "initialDelayInMilliseconds", "type": "int"}, + "max_interval_in_milliseconds": {"key": "maxIntervalInMilliseconds", "type": "int"}, + } + + def __init__( + self, + *, + initial_delay_in_milliseconds: Optional[int] = None, + max_interval_in_milliseconds: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword initial_delay_in_milliseconds: The optional initial delay in milliseconds before an + operation is retried. + :paramtype initial_delay_in_milliseconds: int + :keyword max_interval_in_milliseconds: The optional maximum time interval in milliseconds + between retry attempts. + :paramtype max_interval_in_milliseconds: int + """ + super().__init__(**kwargs) + self.initial_delay_in_milliseconds = initial_delay_in_milliseconds + self.max_interval_in_milliseconds = max_interval_in_milliseconds + + +class DaprComponentResiliencyPolicyHttpRetryPolicyConfiguration(_serialization.Model): # pylint: disable=name-too-long + """Dapr Component Resiliency Policy HTTP Retry Policy Configuration. + + :ivar max_retries: The optional maximum number of retries. + :vartype max_retries: int + :ivar retry_back_off: The optional retry backoff configuration. + :vartype retry_back_off: + ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicyHttpRetryBackOffConfiguration + """ + + _attribute_map = { + "max_retries": {"key": "maxRetries", "type": "int"}, + "retry_back_off": {"key": "retryBackOff", "type": "DaprComponentResiliencyPolicyHttpRetryBackOffConfiguration"}, + } + + def __init__( + self, + *, + max_retries: Optional[int] = None, + retry_back_off: Optional["_models.DaprComponentResiliencyPolicyHttpRetryBackOffConfiguration"] = None, + **kwargs: Any + ) -> None: + """ + :keyword max_retries: The optional maximum number of retries. + :paramtype max_retries: int + :keyword retry_back_off: The optional retry backoff configuration. + :paramtype retry_back_off: + ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicyHttpRetryBackOffConfiguration + """ + super().__init__(**kwargs) + self.max_retries = max_retries + self.retry_back_off = retry_back_off + + +class DaprComponentResiliencyPolicyTimeoutPolicyConfiguration(_serialization.Model): # pylint: disable=name-too-long + """Dapr Component Resiliency Policy Timeout Policy Configuration. + + :ivar response_timeout_in_seconds: The optional response timeout in seconds. + :vartype response_timeout_in_seconds: int + """ + + _attribute_map = { + "response_timeout_in_seconds": {"key": "responseTimeoutInSeconds", "type": "int"}, + } + + def __init__(self, *, response_timeout_in_seconds: Optional[int] = None, **kwargs: Any) -> None: + """ + :keyword response_timeout_in_seconds: The optional response timeout in seconds. + :paramtype response_timeout_in_seconds: int + """ + super().__init__(**kwargs) + self.response_timeout_in_seconds = response_timeout_in_seconds + + +class DaprComponentsCollection(_serialization.Model): + """Dapr Components ARM resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar value: Collection of resources. Required. + :vartype value: list[~azure.mgmt.appcontainers.models.DaprComponent] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[DaprComponent]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.DaprComponent"], **kwargs: Any) -> None: + """ + :keyword value: Collection of resources. Required. + :paramtype value: list[~azure.mgmt.appcontainers.models.DaprComponent] + """ + super().__init__(**kwargs) + self.value = value + self.next_link: Optional[str] = None + + +class DaprComponentServiceBinding(_serialization.Model): + """Configuration to bind a Dapr Component to a dev ContainerApp Service. + + :ivar name: Name of the service bind. + :vartype name: str + :ivar service_id: Resource id of the target service. + :vartype service_id: str + :ivar metadata: Service bind metadata. + :vartype metadata: ~azure.mgmt.appcontainers.models.DaprServiceBindMetadata + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "service_id": {"key": "serviceId", "type": "str"}, + "metadata": {"key": "metadata", "type": "DaprServiceBindMetadata"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + service_id: Optional[str] = None, + metadata: Optional["_models.DaprServiceBindMetadata"] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: Name of the service bind. + :paramtype name: str + :keyword service_id: Resource id of the target service. + :paramtype service_id: str + :keyword metadata: Service bind metadata. + :paramtype metadata: ~azure.mgmt.appcontainers.models.DaprServiceBindMetadata + """ + super().__init__(**kwargs) + self.name = name + self.service_id = service_id + self.metadata = metadata + + +class DaprConfiguration(_serialization.Model): + """Configuration properties Dapr component. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar version: The version of Dapr. + :vartype version: str + """ + + _validation = { + "version": {"readonly": True}, + } + + _attribute_map = { + "version": {"key": "version", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.version: Optional[str] = None class DaprMetadata(_serialization.Model): @@ -3507,8 +5341,8 @@ class DaprSecret(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.name = None - self.value = None + self.name: Optional[str] = None + self.value: Optional[str] = None class DaprSecretsCollection(_serialization.Model): @@ -3537,71 +5371,354 @@ def __init__(self, *, value: List["_models.DaprSecret"], **kwargs: Any) -> None: self.value = value -class DefaultAuthorizationPolicy(_serialization.Model): - """The configuration settings of the Azure Active Directory default authorization policy. +class DaprServiceBindMetadata(_serialization.Model): + """Dapr component metadata. - :ivar allowed_principals: The configuration settings of the Azure Active Directory allowed - principals. - :vartype allowed_principals: ~azure.mgmt.appcontainers.models.AllowedPrincipals - :ivar allowed_applications: The configuration settings of the Azure Active Directory allowed - applications. - :vartype allowed_applications: list[str] + :ivar name: Service bind metadata property name. + :vartype name: str + :ivar value: Service bind metadata property value. + :vartype value: str """ _attribute_map = { - "allowed_principals": {"key": "allowedPrincipals", "type": "AllowedPrincipals"}, - "allowed_applications": {"key": "allowedApplications", "type": "[str]"}, + "name": {"key": "name", "type": "str"}, + "value": {"key": "value", "type": "str"}, } - def __init__( - self, - *, - allowed_principals: Optional["_models.AllowedPrincipals"] = None, - allowed_applications: Optional[List[str]] = None, - **kwargs: Any - ) -> None: + def __init__(self, *, name: Optional[str] = None, value: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword allowed_principals: The configuration settings of the Azure Active Directory allowed - principals. - :paramtype allowed_principals: ~azure.mgmt.appcontainers.models.AllowedPrincipals - :keyword allowed_applications: The configuration settings of the Azure Active Directory allowed - applications. - :paramtype allowed_applications: list[str] + :keyword name: Service bind metadata property name. + :paramtype name: str + :keyword value: Service bind metadata property value. + :paramtype value: str """ super().__init__(**kwargs) - self.allowed_principals = allowed_principals - self.allowed_applications = allowed_applications + self.name = name + self.value = value -class DefaultErrorResponse(_serialization.Model): - """App Service error response. +class DaprSubscription(ProxyResource): + """Dapr PubSub Event Subscription. Variables are only populated by the server, and will be ignored when sending a request. - :ivar error: Error model. - :vartype error: ~azure.mgmt.appcontainers.models.DefaultErrorResponseError + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData + :ivar pubsub_name: Dapr PubSub component name. + :vartype pubsub_name: str + :ivar topic: Topic name. + :vartype topic: str + :ivar dead_letter_topic: Deadletter topic name. + :vartype dead_letter_topic: str + :ivar routes: Subscription routes. + :vartype routes: ~azure.mgmt.appcontainers.models.DaprSubscriptionRoutes + :ivar scopes: Application scopes to restrict the subscription to specific apps. + :vartype scopes: list[str] + :ivar metadata: Subscription metadata. + :vartype metadata: dict[str, str] + :ivar bulk_subscribe: Bulk subscription options. + :vartype bulk_subscribe: ~azure.mgmt.appcontainers.models.DaprSubscriptionBulkSubscribeOptions """ _validation = { - "error": {"readonly": True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, } _attribute_map = { - "error": {"key": "error", "type": "DefaultErrorResponseError"}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "pubsub_name": {"key": "properties.pubsubName", "type": "str"}, + "topic": {"key": "properties.topic", "type": "str"}, + "dead_letter_topic": {"key": "properties.deadLetterTopic", "type": "str"}, + "routes": {"key": "properties.routes", "type": "DaprSubscriptionRoutes"}, + "scopes": {"key": "properties.scopes", "type": "[str]"}, + "metadata": {"key": "properties.metadata", "type": "{str}"}, + "bulk_subscribe": {"key": "properties.bulkSubscribe", "type": "DaprSubscriptionBulkSubscribeOptions"}, } - def __init__(self, **kwargs: Any) -> None: - """ """ + def __init__( + self, + *, + pubsub_name: Optional[str] = None, + topic: Optional[str] = None, + dead_letter_topic: Optional[str] = None, + routes: Optional["_models.DaprSubscriptionRoutes"] = None, + scopes: Optional[List[str]] = None, + metadata: Optional[Dict[str, str]] = None, + bulk_subscribe: Optional["_models.DaprSubscriptionBulkSubscribeOptions"] = None, + **kwargs: Any + ) -> None: + """ + :keyword pubsub_name: Dapr PubSub component name. + :paramtype pubsub_name: str + :keyword topic: Topic name. + :paramtype topic: str + :keyword dead_letter_topic: Deadletter topic name. + :paramtype dead_letter_topic: str + :keyword routes: Subscription routes. + :paramtype routes: ~azure.mgmt.appcontainers.models.DaprSubscriptionRoutes + :keyword scopes: Application scopes to restrict the subscription to specific apps. + :paramtype scopes: list[str] + :keyword metadata: Subscription metadata. + :paramtype metadata: dict[str, str] + :keyword bulk_subscribe: Bulk subscription options. + :paramtype bulk_subscribe: + ~azure.mgmt.appcontainers.models.DaprSubscriptionBulkSubscribeOptions + """ super().__init__(**kwargs) - self.error = None + self.pubsub_name = pubsub_name + self.topic = topic + self.dead_letter_topic = dead_letter_topic + self.routes = routes + self.scopes = scopes + self.metadata = metadata + self.bulk_subscribe = bulk_subscribe -class DefaultErrorResponseError(_serialization.Model): - """Error model. +class DaprSubscriptionBulkSubscribeOptions(_serialization.Model): + """Dapr PubSub Bulk Subscription Options. - Variables are only populated by the server, and will be ignored when sending a request. + :ivar enabled: Enable bulk subscription. + :vartype enabled: bool + :ivar max_messages_count: Maximum number of messages to deliver in a bulk message. + :vartype max_messages_count: int + :ivar max_await_duration_ms: Maximum duration in milliseconds to wait before a bulk message is + sent to the app. + :vartype max_await_duration_ms: int + """ - :ivar code: Standardized string to programmatically identify the error. + _attribute_map = { + "enabled": {"key": "enabled", "type": "bool"}, + "max_messages_count": {"key": "maxMessagesCount", "type": "int"}, + "max_await_duration_ms": {"key": "maxAwaitDurationMs", "type": "int"}, + } + + def __init__( + self, + *, + enabled: bool = False, + max_messages_count: Optional[int] = None, + max_await_duration_ms: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword enabled: Enable bulk subscription. + :paramtype enabled: bool + :keyword max_messages_count: Maximum number of messages to deliver in a bulk message. + :paramtype max_messages_count: int + :keyword max_await_duration_ms: Maximum duration in milliseconds to wait before a bulk message + is sent to the app. + :paramtype max_await_duration_ms: int + """ + super().__init__(**kwargs) + self.enabled = enabled + self.max_messages_count = max_messages_count + self.max_await_duration_ms = max_await_duration_ms + + +class DaprSubscriptionRouteRule(_serialization.Model): + """Dapr Pubsub Event Subscription Route Rule is used to specify the condition for sending a + message to a specific path. + + :ivar match: The optional CEL expression used to match the event. If the match is not + specified, then the route is considered the default. The rules are tested in the order + specified, so they should be define from most-to-least specific. The default route should + appear last in the list. + :vartype match: str + :ivar path: The path for events that match this rule. + :vartype path: str + """ + + _attribute_map = { + "match": {"key": "match", "type": "str"}, + "path": {"key": "path", "type": "str"}, + } + + def __init__(self, *, match: Optional[str] = None, path: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword match: The optional CEL expression used to match the event. If the match is not + specified, then the route is considered the default. The rules are tested in the order + specified, so they should be define from most-to-least specific. The default route should + appear last in the list. + :paramtype match: str + :keyword path: The path for events that match this rule. + :paramtype path: str + """ + super().__init__(**kwargs) + self.match = match + self.path = path + + +class DaprSubscriptionRoutes(_serialization.Model): + """Dapr PubSub Event Subscription Routes configuration. + + :ivar rules: The list of Dapr PubSub Event Subscription Route Rules. + :vartype rules: list[~azure.mgmt.appcontainers.models.DaprSubscriptionRouteRule] + :ivar default: The default path to deliver events that do not match any of the rules. + :vartype default: str + """ + + _attribute_map = { + "rules": {"key": "rules", "type": "[DaprSubscriptionRouteRule]"}, + "default": {"key": "default", "type": "str"}, + } + + def __init__( + self, + *, + rules: Optional[List["_models.DaprSubscriptionRouteRule"]] = None, + default: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword rules: The list of Dapr PubSub Event Subscription Route Rules. + :paramtype rules: list[~azure.mgmt.appcontainers.models.DaprSubscriptionRouteRule] + :keyword default: The default path to deliver events that do not match any of the rules. + :paramtype default: str + """ + super().__init__(**kwargs) + self.rules = rules + self.default = default + + +class DaprSubscriptionsCollection(_serialization.Model): + """Dapr Subscriptions ARM resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar value: Collection of resources. Required. + :vartype value: list[~azure.mgmt.appcontainers.models.DaprSubscription] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[DaprSubscription]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.DaprSubscription"], **kwargs: Any) -> None: + """ + :keyword value: Collection of resources. Required. + :paramtype value: list[~azure.mgmt.appcontainers.models.DaprSubscription] + """ + super().__init__(**kwargs) + self.value = value + self.next_link: Optional[str] = None + + +class DataDogConfiguration(_serialization.Model): + """Configuration of datadog. + + :ivar site: The data dog site. + :vartype site: str + :ivar key: The data dog api key. + :vartype key: str + """ + + _attribute_map = { + "site": {"key": "site", "type": "str"}, + "key": {"key": "key", "type": "str"}, + } + + def __init__(self, *, site: Optional[str] = None, key: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword site: The data dog site. + :paramtype site: str + :keyword key: The data dog api key. + :paramtype key: str + """ + super().__init__(**kwargs) + self.site = site + self.key = key + + +class DefaultAuthorizationPolicy(_serialization.Model): + """The configuration settings of the Azure Active Directory default authorization policy. + + :ivar allowed_principals: The configuration settings of the Azure Active Directory allowed + principals. + :vartype allowed_principals: ~azure.mgmt.appcontainers.models.AllowedPrincipals + :ivar allowed_applications: The configuration settings of the Azure Active Directory allowed + applications. + :vartype allowed_applications: list[str] + """ + + _attribute_map = { + "allowed_principals": {"key": "allowedPrincipals", "type": "AllowedPrincipals"}, + "allowed_applications": {"key": "allowedApplications", "type": "[str]"}, + } + + def __init__( + self, + *, + allowed_principals: Optional["_models.AllowedPrincipals"] = None, + allowed_applications: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword allowed_principals: The configuration settings of the Azure Active Directory allowed + principals. + :paramtype allowed_principals: ~azure.mgmt.appcontainers.models.AllowedPrincipals + :keyword allowed_applications: The configuration settings of the Azure Active Directory allowed + applications. + :paramtype allowed_applications: list[str] + """ + super().__init__(**kwargs) + self.allowed_principals = allowed_principals + self.allowed_applications = allowed_applications + + +class DefaultErrorResponse(_serialization.Model): + """App Service error response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar error: Error model. + :vartype error: ~azure.mgmt.appcontainers.models.DefaultErrorResponseError + """ + + _validation = { + "error": {"readonly": True}, + } + + _attribute_map = { + "error": {"key": "error", "type": "DefaultErrorResponseError"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.error: Optional["_models.DefaultErrorResponseError"] = None + + +class DefaultErrorResponseError(_serialization.Model): + """Error model. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: Standardized string to programmatically identify the error. :vartype code: str :ivar message: Detailed error description and debugging information. :vartype message: str @@ -3636,11 +5753,11 @@ def __init__( :paramtype details: list[~azure.mgmt.appcontainers.models.DefaultErrorResponseErrorDetailsItem] """ super().__init__(**kwargs) - self.code = None - self.message = None - self.target = None + self.code: Optional[str] = None + self.message: Optional[str] = None + self.target: Optional[str] = None self.details = details - self.innererror = None + self.innererror: Optional[str] = None class DefaultErrorResponseErrorDetailsItem(_serialization.Model): @@ -3671,9 +5788,41 @@ class DefaultErrorResponseErrorDetailsItem(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.code = None - self.message = None - self.target = None + self.code: Optional[str] = None + self.message: Optional[str] = None + self.target: Optional[str] = None + + +class DestinationsConfiguration(_serialization.Model): + """Configuration of Open Telemetry destinations. + + :ivar data_dog_configuration: Open telemetry datadog destination configuration. + :vartype data_dog_configuration: ~azure.mgmt.appcontainers.models.DataDogConfiguration + :ivar otlp_configurations: Open telemetry otlp configurations. + :vartype otlp_configurations: list[~azure.mgmt.appcontainers.models.OtlpConfiguration] + """ + + _attribute_map = { + "data_dog_configuration": {"key": "dataDogConfiguration", "type": "DataDogConfiguration"}, + "otlp_configurations": {"key": "otlpConfigurations", "type": "[OtlpConfiguration]"}, + } + + def __init__( + self, + *, + data_dog_configuration: Optional["_models.DataDogConfiguration"] = None, + otlp_configurations: Optional[List["_models.OtlpConfiguration"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword data_dog_configuration: Open telemetry datadog destination configuration. + :paramtype data_dog_configuration: ~azure.mgmt.appcontainers.models.DataDogConfiguration + :keyword otlp_configurations: Open telemetry otlp configurations. + :paramtype otlp_configurations: list[~azure.mgmt.appcontainers.models.OtlpConfiguration] + """ + super().__init__(**kwargs) + self.data_dog_configuration = data_dog_configuration + self.otlp_configurations = otlp_configurations class DiagnosticDataProviderMetadata(_serialization.Model): @@ -3866,7 +6015,7 @@ class Diagnostics(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -3934,7 +6083,7 @@ def __init__(self, *, value: List["_models.Diagnostics"], **kwargs: Any) -> None """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class DiagnosticsDataApiResponse(_serialization.Model): @@ -4030,15 +6179,15 @@ def __init__( :paramtype analysis_types: list[str] """ super().__init__(**kwargs) - self.id = None - self.name = None - self.description = None - self.author = None - self.category = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.description: Optional[str] = None + self.author: Optional[str] = None + self.category: Optional[str] = None self.support_topic_list = support_topic_list self.analysis_types = analysis_types - self.type = None - self.score = None + self.type: Optional[str] = None + self.score: Optional[float] = None class DiagnosticsProperties(_serialization.Model): @@ -4139,80 +6288,17 @@ class DiagnosticSupportTopic(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.id = None - self.pes_id = None - - -class DynamicPoolConfiguration(_serialization.Model): - """Dynamic pool configuration. - - :ivar lifecycle_configuration: The lifecycle configuration of a session in the dynamic session - pool. - :vartype lifecycle_configuration: ~azure.mgmt.appcontainers.models.LifecycleConfiguration - """ - - _attribute_map = { - "lifecycle_configuration": {"key": "lifecycleConfiguration", "type": "LifecycleConfiguration"}, - } - - def __init__( - self, *, lifecycle_configuration: Optional["_models.LifecycleConfiguration"] = None, **kwargs: Any - ) -> None: - """ - :keyword lifecycle_configuration: The lifecycle configuration of a session in the dynamic - session pool. - :paramtype lifecycle_configuration: ~azure.mgmt.appcontainers.models.LifecycleConfiguration - """ - super().__init__(**kwargs) - self.lifecycle_configuration = lifecycle_configuration - - -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 + self.id: Optional[str] = None + self.pes_id: Optional[str] = None -class EnvironmentAuthToken(TrackedResource): - """Environment Auth Token. +class DotNetComponent(ProxyResource): + """.NET Component. Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to server. - :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -4222,14 +6308,17 @@ class EnvironmentAuthToken(TrackedResource): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar token: Auth token value. - :vartype token: str - :ivar expires: Token expiration date. - :vartype expires: ~datetime.datetime + :ivar component_type: Type of the .NET Component. "AspireDashboard" + :vartype component_type: str or ~azure.mgmt.appcontainers.models.DotNetComponentType + :ivar provisioning_state: Provisioning state of the .NET Component. Known values are: + "Succeeded", "Failed", "Canceled", "Deleting", and "InProgress". + :vartype provisioning_state: str or + ~azure.mgmt.appcontainers.models.DotNetComponentProvisioningState + :ivar configurations: List of .NET Components configuration properties. + :vartype configurations: + list[~azure.mgmt.appcontainers.models.DotNetComponentConfigurationProperty] + :ivar service_binds: List of .NET Components that are bound to the .NET component. + :vartype service_binds: list[~azure.mgmt.appcontainers.models.DotNetComponentServiceBind] """ _validation = { @@ -4237,9 +6326,7 @@ class EnvironmentAuthToken(TrackedResource): "name": {"readonly": True}, "type": {"readonly": True}, "system_data": {"readonly": True}, - "location": {"required": True}, - "token": {"readonly": True}, - "expires": {"readonly": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { @@ -4247,22 +6334,241 @@ class EnvironmentAuthToken(TrackedResource): "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, "system_data": {"key": "systemData", "type": "SystemData"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "token": {"key": "properties.token", "type": "str"}, - "expires": {"key": "properties.expires", "type": "iso-8601"}, + "component_type": {"key": "properties.componentType", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "configurations": {"key": "properties.configurations", "type": "[DotNetComponentConfigurationProperty]"}, + "service_binds": {"key": "properties.serviceBinds", "type": "[DotNetComponentServiceBind]"}, } - def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] + def __init__( + self, + *, + component_type: Optional[Union[str, "_models.DotNetComponentType"]] = None, + configurations: Optional[List["_models.DotNetComponentConfigurationProperty"]] = None, + service_binds: Optional[List["_models.DotNetComponentServiceBind"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword component_type: Type of the .NET Component. "AspireDashboard" + :paramtype component_type: str or ~azure.mgmt.appcontainers.models.DotNetComponentType + :keyword configurations: List of .NET Components configuration properties. + :paramtype configurations: + list[~azure.mgmt.appcontainers.models.DotNetComponentConfigurationProperty] + :keyword service_binds: List of .NET Components that are bound to the .NET component. + :paramtype service_binds: list[~azure.mgmt.appcontainers.models.DotNetComponentServiceBind] + """ + super().__init__(**kwargs) + self.component_type = component_type + self.provisioning_state: Optional[Union[str, "_models.DotNetComponentProvisioningState"]] = None + self.configurations = configurations + self.service_binds = service_binds + + +class DotNetComponentConfigurationProperty(_serialization.Model): + """Configuration properties for a .NET Component. + + :ivar property_name: The name of the property. + :vartype property_name: str + :ivar value: The value of the property. + :vartype value: str + """ + + _attribute_map = { + "property_name": {"key": "propertyName", "type": "str"}, + "value": {"key": "value", "type": "str"}, + } + + def __init__(self, *, property_name: Optional[str] = None, value: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword property_name: The name of the property. + :paramtype property_name: str + :keyword value: The value of the property. + :paramtype value: str + """ + super().__init__(**kwargs) + self.property_name = property_name + self.value = value + + +class DotNetComponentsCollection(_serialization.Model): + """.NET Components ARM resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar value: Collection of resources. Required. + :vartype value: list[~azure.mgmt.appcontainers.models.DotNetComponent] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[DotNetComponent]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.DotNetComponent"], **kwargs: Any) -> None: + """ + :keyword value: Collection of resources. Required. + :paramtype value: list[~azure.mgmt.appcontainers.models.DotNetComponent] + """ + super().__init__(**kwargs) + self.value = value + self.next_link: Optional[str] = None + + +class DotNetComponentServiceBind(_serialization.Model): + """Configuration to bind a .NET Component to another .NET Component. + + :ivar name: Name of the service bind. + :vartype name: str + :ivar service_id: Resource id of the target service. + :vartype service_id: str + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "service_id": {"key": "serviceId", "type": "str"}, + } + + def __init__(self, *, name: Optional[str] = None, service_id: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword name: Name of the service bind. + :paramtype name: str + :keyword service_id: Resource id of the target service. + :paramtype service_id: str + """ + super().__init__(**kwargs) + self.name = name + self.service_id = service_id + + +class DynamicPoolConfiguration(_serialization.Model): + """Dynamic pool configuration. + + :ivar lifecycle_configuration: The lifecycle configuration of a session in the dynamic session + pool. + :vartype lifecycle_configuration: ~azure.mgmt.appcontainers.models.LifecycleConfiguration + """ + + _attribute_map = { + "lifecycle_configuration": {"key": "lifecycleConfiguration", "type": "LifecycleConfiguration"}, + } + + def __init__( + self, *, lifecycle_configuration: Optional["_models.LifecycleConfiguration"] = None, **kwargs: Any + ) -> None: + """ + :keyword lifecycle_configuration: The lifecycle configuration of a session in the dynamic + session pool. + :paramtype lifecycle_configuration: ~azure.mgmt.appcontainers.models.LifecycleConfiguration + """ + super().__init__(**kwargs) + self.lifecycle_configuration = lifecycle_configuration + + +class EncryptionSettings(_serialization.Model): + """The configuration settings of the secrets references of encryption key and signing key for + ContainerApp Service Authentication/Authorization. + + :ivar container_app_auth_encryption_secret_name: The secret name which is referenced for + EncryptionKey. + :vartype container_app_auth_encryption_secret_name: str + :ivar container_app_auth_signing_secret_name: The secret name which is referenced for + SigningKey. + :vartype container_app_auth_signing_secret_name: str + """ + + _attribute_map = { + "container_app_auth_encryption_secret_name": {"key": "containerAppAuthEncryptionSecretName", "type": "str"}, + "container_app_auth_signing_secret_name": {"key": "containerAppAuthSigningSecretName", "type": "str"}, + } + + def __init__( + self, + *, + container_app_auth_encryption_secret_name: Optional[str] = None, + container_app_auth_signing_secret_name: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword container_app_auth_encryption_secret_name: The secret name which is referenced for + EncryptionKey. + :paramtype container_app_auth_encryption_secret_name: str + :keyword container_app_auth_signing_secret_name: The secret name which is referenced for + SigningKey. + :paramtype container_app_auth_signing_secret_name: str + """ + super().__init__(**kwargs) + self.container_app_auth_encryption_secret_name = container_app_auth_encryption_secret_name + self.container_app_auth_signing_secret_name = container_app_auth_signing_secret_name + + +class EnvironmentAuthToken(TrackedResource): + """Environment Auth Token. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar token: Auth token value. + :vartype token: str + :ivar expires: Token expiration date. + :vartype expires: ~datetime.datetime + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, + "token": {"readonly": True}, + "expires": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "token": {"key": "properties.token", "type": "str"}, + "expires": {"key": "properties.expires", "type": "iso-8601"}, + } + + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] :keyword location: The geo-location where the resource lives. Required. :paramtype location: str """ super().__init__(tags=tags, location=location, **kwargs) - self.token = None - self.expires = None + self.token: Optional[str] = None + self.expires: Optional[datetime.datetime] = None class EnvironmentVar(_serialization.Model): @@ -4306,6 +6612,39 @@ def __init__( self.secret_ref = secret_ref +class EnvironmentVariable(_serialization.Model): + """Model representing an environment variable. + + All required parameters must be populated in order to send to server. + + :ivar name: Environment variable name. Required. + :vartype name: str + :ivar value: Environment variable value. Required. + :vartype value: str + """ + + _validation = { + "name": {"required": True}, + "value": {"required": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "value": {"key": "value", "type": "str"}, + } + + def __init__(self, *, name: str, value: str, **kwargs: Any) -> None: + """ + :keyword name: Environment variable name. Required. + :paramtype name: str + :keyword value: Environment variable value. Required. + :paramtype value: str + """ + super().__init__(**kwargs) + self.name = name + self.value = value + + class ErrorAdditionalInfo(_serialization.Model): """The resource management error additional info. @@ -4330,8 +6669,8 @@ class ErrorAdditionalInfo(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.type = None - self.info = None + self.type: Optional[str] = None + self.info: Optional[JSON] = None class ErrorDetail(_serialization.Model): @@ -4370,11 +6709,85 @@ class ErrorDetail(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None + self.code: Optional[str] = None + self.message: Optional[str] = None + self.target: Optional[str] = None + self.details: Optional[List["_models.ErrorDetail"]] = None + self.additional_info: Optional[List["_models.ErrorAdditionalInfo"]] = None + + +class ErrorEntity(_serialization.Model): + """Body of the error response returned from the API. + + :ivar extended_code: Type of error. + :vartype extended_code: str + :ivar message_template: Message template. + :vartype message_template: str + :ivar parameters: Parameters for the template. + :vartype parameters: list[str] + :ivar inner_errors: Inner errors. + :vartype inner_errors: list[~azure.mgmt.appcontainers.models.ErrorEntity] + :ivar details: Error Details. + :vartype details: list[~azure.mgmt.appcontainers.models.ErrorEntity] + :ivar target: The error target. + :vartype target: str + :ivar code: Basic error code. + :vartype code: str + :ivar message: Any details of the error. + :vartype message: str + """ + + _attribute_map = { + "extended_code": {"key": "extendedCode", "type": "str"}, + "message_template": {"key": "messageTemplate", "type": "str"}, + "parameters": {"key": "parameters", "type": "[str]"}, + "inner_errors": {"key": "innerErrors", "type": "[ErrorEntity]"}, + "details": {"key": "details", "type": "[ErrorEntity]"}, + "target": {"key": "target", "type": "str"}, + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + } + + def __init__( + self, + *, + extended_code: Optional[str] = None, + message_template: Optional[str] = None, + parameters: Optional[List[str]] = None, + inner_errors: Optional[List["_models.ErrorEntity"]] = None, + details: Optional[List["_models.ErrorEntity"]] = None, + target: Optional[str] = None, + code: Optional[str] = None, + message: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword extended_code: Type of error. + :paramtype extended_code: str + :keyword message_template: Message template. + :paramtype message_template: str + :keyword parameters: Parameters for the template. + :paramtype parameters: list[str] + :keyword inner_errors: Inner errors. + :paramtype inner_errors: list[~azure.mgmt.appcontainers.models.ErrorEntity] + :keyword details: Error Details. + :paramtype details: list[~azure.mgmt.appcontainers.models.ErrorEntity] + :keyword target: The error target. + :paramtype target: str + :keyword code: Basic error code. + :paramtype code: str + :keyword message: Any details of the error. + :paramtype message: str + """ + super().__init__(**kwargs) + self.extended_code = extended_code + self.message_template = message_template + self.parameters = parameters + self.inner_errors = inner_errors + self.details = details + self.target = target + self.code = code + self.message = message class ErrorResponse(_serialization.Model): @@ -4398,11 +6811,31 @@ def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: A self.error = error -class ExtendedLocation(_serialization.Model): - """The complex type of the extended location. +class ExecutionStatus(_serialization.Model): + """Container Apps Job execution status. - :ivar name: The name of the extended location. - :vartype name: str + :ivar replicas: Replicas in the execution. + :vartype replicas: list[~azure.mgmt.appcontainers.models.ReplicaExecutionStatus] + """ + + _attribute_map = { + "replicas": {"key": "replicas", "type": "[ReplicaExecutionStatus]"}, + } + + def __init__(self, *, replicas: Optional[List["_models.ReplicaExecutionStatus"]] = None, **kwargs: Any) -> None: + """ + :keyword replicas: Replicas in the execution. + :paramtype replicas: list[~azure.mgmt.appcontainers.models.ReplicaExecutionStatus] + """ + super().__init__(**kwargs) + self.replicas = replicas + + +class ExtendedLocation(_serialization.Model): + """The complex type of the extended location. + + :ivar name: The name of the extended location. + :vartype name: str :ivar type: The type of the extended location. "CustomLocation" :vartype type: str or ~azure.mgmt.appcontainers.models.ExtendedLocationTypes """ @@ -4572,6 +7005,8 @@ class GithubActionConfiguration(_serialization.Model): :vartype azure_credentials: ~azure.mgmt.appcontainers.models.AzureCredentials :ivar context_path: Context path. :vartype context_path: str + :ivar dockerfile_path: Dockerfile path. + :vartype dockerfile_path: str :ivar github_personal_access_token: One time Github PAT to configure github environment. :vartype github_personal_access_token: str :ivar image: Image name. @@ -4584,18 +7019,23 @@ class GithubActionConfiguration(_serialization.Model): :vartype runtime_stack: str :ivar runtime_version: Runtime version. :vartype runtime_version: str + :ivar build_environment_variables: List of environment variables to be passed to the build. + :vartype build_environment_variables: + list[~azure.mgmt.appcontainers.models.EnvironmentVariable] """ _attribute_map = { "registry_info": {"key": "registryInfo", "type": "RegistryInfo"}, "azure_credentials": {"key": "azureCredentials", "type": "AzureCredentials"}, "context_path": {"key": "contextPath", "type": "str"}, + "dockerfile_path": {"key": "dockerfilePath", "type": "str"}, "github_personal_access_token": {"key": "githubPersonalAccessToken", "type": "str"}, "image": {"key": "image", "type": "str"}, "publish_type": {"key": "publishType", "type": "str"}, "os": {"key": "os", "type": "str"}, "runtime_stack": {"key": "runtimeStack", "type": "str"}, "runtime_version": {"key": "runtimeVersion", "type": "str"}, + "build_environment_variables": {"key": "buildEnvironmentVariables", "type": "[EnvironmentVariable]"}, } def __init__( @@ -4604,12 +7044,14 @@ def __init__( registry_info: Optional["_models.RegistryInfo"] = None, azure_credentials: Optional["_models.AzureCredentials"] = None, context_path: Optional[str] = None, + dockerfile_path: Optional[str] = None, github_personal_access_token: Optional[str] = None, image: Optional[str] = None, publish_type: Optional[str] = None, os: Optional[str] = None, runtime_stack: Optional[str] = None, runtime_version: Optional[str] = None, + build_environment_variables: Optional[List["_models.EnvironmentVariable"]] = None, **kwargs: Any ) -> None: """ @@ -4619,6 +7061,8 @@ def __init__( :paramtype azure_credentials: ~azure.mgmt.appcontainers.models.AzureCredentials :keyword context_path: Context path. :paramtype context_path: str + :keyword dockerfile_path: Dockerfile path. + :paramtype dockerfile_path: str :keyword github_personal_access_token: One time Github PAT to configure github environment. :paramtype github_personal_access_token: str :keyword image: Image name. @@ -4631,17 +7075,22 @@ def __init__( :paramtype runtime_stack: str :keyword runtime_version: Runtime version. :paramtype runtime_version: str + :keyword build_environment_variables: List of environment variables to be passed to the build. + :paramtype build_environment_variables: + list[~azure.mgmt.appcontainers.models.EnvironmentVariable] """ super().__init__(**kwargs) self.registry_info = registry_info self.azure_credentials = azure_credentials self.context_path = context_path + self.dockerfile_path = dockerfile_path self.github_personal_access_token = github_personal_access_token self.image = image self.publish_type = publish_type self.os = os self.runtime_stack = runtime_stack self.runtime_version = runtime_version + self.build_environment_variables = build_environment_variables class GlobalValidation(_serialization.Model): @@ -4655,8 +7104,7 @@ class GlobalValidation(_serialization.Model): ~azure.mgmt.appcontainers.models.UnauthenticatedClientActionV2 :ivar redirect_to_provider: The default authentication provider to use when multiple providers are configured. - This setting is only needed if multiple providers are configured and the unauthenticated - client + This setting is only needed if multiple providers are configured and the unauthenticated client action is set to "RedirectToLoginPage". :vartype redirect_to_provider: str :ivar excluded_paths: The paths for which unauthenticated flow would not be redirected to the @@ -4686,8 +7134,7 @@ def __init__( ~azure.mgmt.appcontainers.models.UnauthenticatedClientActionV2 :keyword redirect_to_provider: The default authentication provider to use when multiple providers are configured. - This setting is only needed if multiple providers are configured and the unauthenticated - client + This setting is only needed if multiple providers are configured and the unauthenticated client action is set to "RedirectToLoginPage". :paramtype redirect_to_provider: str :keyword excluded_paths: The paths for which unauthenticated flow would not be redirected to @@ -4751,513 +7198,278 @@ def __init__( self.validation = validation -class HttpScaleRule(_serialization.Model): - """Container App container Http scaling rule. +class Header(_serialization.Model): + """Header of otlp configuration. - :ivar metadata: Metadata properties to describe http scale rule. - :vartype metadata: dict[str, str] - :ivar auth: Authentication secrets for the custom scale rule. - :vartype auth: list[~azure.mgmt.appcontainers.models.ScaleRuleAuth] - :ivar identity: The resource ID of a user-assigned managed identity that is assigned to the - Container App, or 'system' for system-assigned identity. - :vartype identity: str + :ivar key: The key of otlp configuration header. + :vartype key: str + :ivar value: The value of otlp configuration header. + :vartype value: str """ _attribute_map = { - "metadata": {"key": "metadata", "type": "{str}"}, - "auth": {"key": "auth", "type": "[ScaleRuleAuth]"}, - "identity": {"key": "identity", "type": "str"}, + "key": {"key": "key", "type": "str"}, + "value": {"key": "value", "type": "str"}, + } + + def __init__(self, *, key: Optional[str] = None, value: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword key: The key of otlp configuration header. + :paramtype key: str + :keyword value: The value of otlp configuration header. + :paramtype value: str + """ + super().__init__(**kwargs) + self.key = key + self.value = value + + +class HeaderMatch(_serialization.Model): + """Conditions required to match a header. + + :ivar header: Name of the header. + :vartype header: str + :ivar exact_match: Exact value of the header. + :vartype exact_match: str + :ivar prefix_match: Prefix value of the header. + :vartype prefix_match: str + :ivar suffix_match: Suffix value of the header. + :vartype suffix_match: str + :ivar regex_match: Regex value of the header. + :vartype regex_match: str + """ + + _attribute_map = { + "header": {"key": "header", "type": "str"}, + "exact_match": {"key": "match.exactMatch", "type": "str"}, + "prefix_match": {"key": "match.prefixMatch", "type": "str"}, + "suffix_match": {"key": "match.suffixMatch", "type": "str"}, + "regex_match": {"key": "match.regexMatch", "type": "str"}, } def __init__( self, *, - metadata: Optional[Dict[str, str]] = None, - auth: Optional[List["_models.ScaleRuleAuth"]] = None, - identity: Optional[str] = None, + header: Optional[str] = None, + exact_match: Optional[str] = None, + prefix_match: Optional[str] = None, + suffix_match: Optional[str] = None, + regex_match: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword metadata: Metadata properties to describe http scale rule. - :paramtype metadata: dict[str, str] - :keyword auth: Authentication secrets for the custom scale rule. - :paramtype auth: list[~azure.mgmt.appcontainers.models.ScaleRuleAuth] - :keyword identity: The resource ID of a user-assigned managed identity that is assigned to the - Container App, or 'system' for system-assigned identity. - :paramtype identity: str + :keyword header: Name of the header. + :paramtype header: str + :keyword exact_match: Exact value of the header. + :paramtype exact_match: str + :keyword prefix_match: Prefix value of the header. + :paramtype prefix_match: str + :keyword suffix_match: Suffix value of the header. + :paramtype suffix_match: str + :keyword regex_match: Regex value of the header. + :paramtype regex_match: str """ super().__init__(**kwargs) - self.metadata = metadata - self.auth = auth - self.identity = identity + self.header = header + self.exact_match = exact_match + self.prefix_match = prefix_match + self.suffix_match = suffix_match + self.regex_match = regex_match -class HttpSettings(_serialization.Model): - """The configuration settings of the HTTP requests for authentication and authorization requests - made against ContainerApp Service Authentication/Authorization. +class HttpConnectionPool(_serialization.Model): + """Defines parameters for http connection pooling. - :ivar require_https: :code:`false` if the authentication/authorization responses - not having the HTTPS scheme are permissible; otherwise, :code:`true`. - :vartype require_https: bool - :ivar routes: The configuration settings of the paths HTTP requests. - :vartype routes: ~azure.mgmt.appcontainers.models.HttpSettingsRoutes - :ivar forward_proxy: The configuration settings of a forward proxy used to make the requests. - :vartype forward_proxy: ~azure.mgmt.appcontainers.models.ForwardProxy + :ivar http1_max_pending_requests: Maximum number of pending http1 requests allowed. + :vartype http1_max_pending_requests: int + :ivar http2_max_requests: Maximum number of http2 requests allowed. + :vartype http2_max_requests: int """ _attribute_map = { - "require_https": {"key": "requireHttps", "type": "bool"}, - "routes": {"key": "routes", "type": "HttpSettingsRoutes"}, - "forward_proxy": {"key": "forwardProxy", "type": "ForwardProxy"}, + "http1_max_pending_requests": {"key": "http1MaxPendingRequests", "type": "int"}, + "http2_max_requests": {"key": "http2MaxRequests", "type": "int"}, } def __init__( self, *, - require_https: Optional[bool] = None, - routes: Optional["_models.HttpSettingsRoutes"] = None, - forward_proxy: Optional["_models.ForwardProxy"] = None, + http1_max_pending_requests: Optional[int] = None, + http2_max_requests: Optional[int] = None, **kwargs: Any ) -> None: """ - :keyword require_https: :code:`false` if the authentication/authorization - responses not having the HTTPS scheme are permissible; otherwise, :code:`true`. - :paramtype require_https: bool - :keyword routes: The configuration settings of the paths HTTP requests. - :paramtype routes: ~azure.mgmt.appcontainers.models.HttpSettingsRoutes - :keyword forward_proxy: The configuration settings of a forward proxy used to make the - requests. - :paramtype forward_proxy: ~azure.mgmt.appcontainers.models.ForwardProxy + :keyword http1_max_pending_requests: Maximum number of pending http1 requests allowed. + :paramtype http1_max_pending_requests: int + :keyword http2_max_requests: Maximum number of http2 requests allowed. + :paramtype http2_max_requests: int """ super().__init__(**kwargs) - self.require_https = require_https - self.routes = routes - self.forward_proxy = forward_proxy + self.http1_max_pending_requests = http1_max_pending_requests + self.http2_max_requests = http2_max_requests -class HttpSettingsRoutes(_serialization.Model): - """The configuration settings of the paths HTTP requests. +class HttpGet(_serialization.Model): + """Model representing a http get request. - :ivar api_prefix: The prefix that should precede all the authentication/authorization paths. - :vartype api_prefix: str + All required parameters must be populated in order to send to server. + + :ivar url: URL to make HTTP GET request against. Required. + :vartype url: str + :ivar file_name: Name of the file that the request should be saved to. + :vartype file_name: str + :ivar headers: List of headers to send with the request. + :vartype headers: list[str] """ + _validation = { + "url": {"required": True}, + } + _attribute_map = { - "api_prefix": {"key": "apiPrefix", "type": "str"}, + "url": {"key": "url", "type": "str"}, + "file_name": {"key": "fileName", "type": "str"}, + "headers": {"key": "headers", "type": "[str]"}, } - def __init__(self, *, api_prefix: Optional[str] = None, **kwargs: Any) -> None: + def __init__( + self, *, url: str, file_name: Optional[str] = None, headers: Optional[List[str]] = None, **kwargs: Any + ) -> None: """ - :keyword api_prefix: The prefix that should precede all the authentication/authorization paths. - :paramtype api_prefix: str + :keyword url: URL to make HTTP GET request against. Required. + :paramtype url: str + :keyword file_name: Name of the file that the request should be saved to. + :paramtype file_name: str + :keyword headers: List of headers to send with the request. + :paramtype headers: list[str] """ super().__init__(**kwargs) - self.api_prefix = api_prefix + self.url = url + self.file_name = file_name + self.headers = headers -class IdentityProviders(_serialization.Model): - """The configuration settings of each of the identity providers used to configure ContainerApp - Service Authentication/Authorization. +class HttpRetryPolicy(_serialization.Model): + """Policy that defines http request retry conditions. - :ivar azure_active_directory: The configuration settings of the Azure Active directory - provider. - :vartype azure_active_directory: ~azure.mgmt.appcontainers.models.AzureActiveDirectory - :ivar facebook: The configuration settings of the Facebook provider. - :vartype facebook: ~azure.mgmt.appcontainers.models.Facebook - :ivar git_hub: The configuration settings of the GitHub provider. - :vartype git_hub: ~azure.mgmt.appcontainers.models.GitHub - :ivar google: The configuration settings of the Google provider. - :vartype google: ~azure.mgmt.appcontainers.models.Google - :ivar twitter: The configuration settings of the Twitter provider. - :vartype twitter: ~azure.mgmt.appcontainers.models.Twitter - :ivar apple: The configuration settings of the Apple provider. - :vartype apple: ~azure.mgmt.appcontainers.models.Apple - :ivar azure_static_web_apps: The configuration settings of the Azure Static Web Apps provider. - :vartype azure_static_web_apps: ~azure.mgmt.appcontainers.models.AzureStaticWebApps - :ivar custom_open_id_connect_providers: The map of the name of the alias of each custom Open ID - Connect provider to the - configuration settings of the custom Open ID Connect provider. - :vartype custom_open_id_connect_providers: dict[str, - ~azure.mgmt.appcontainers.models.CustomOpenIdConnectProvider] + :ivar max_retries: Maximum number of times a request will retry. + :vartype max_retries: int + :ivar headers: Headers that must be present for a request to be retried. + :vartype headers: list[~azure.mgmt.appcontainers.models.HeaderMatch] + :ivar http_status_codes: Additional http status codes that can trigger a retry. + :vartype http_status_codes: list[int] + :ivar errors: Errors that can trigger a retry. + :vartype errors: list[str] + :ivar initial_delay_in_milliseconds: Initial delay, in milliseconds, before retrying a request. + :vartype initial_delay_in_milliseconds: int + :ivar max_interval_in_milliseconds: Maximum interval, in milliseconds, between retries. + :vartype max_interval_in_milliseconds: int """ _attribute_map = { - "azure_active_directory": {"key": "azureActiveDirectory", "type": "AzureActiveDirectory"}, - "facebook": {"key": "facebook", "type": "Facebook"}, - "git_hub": {"key": "gitHub", "type": "GitHub"}, - "google": {"key": "google", "type": "Google"}, - "twitter": {"key": "twitter", "type": "Twitter"}, - "apple": {"key": "apple", "type": "Apple"}, - "azure_static_web_apps": {"key": "azureStaticWebApps", "type": "AzureStaticWebApps"}, - "custom_open_id_connect_providers": { - "key": "customOpenIdConnectProviders", - "type": "{CustomOpenIdConnectProvider}", - }, + "max_retries": {"key": "maxRetries", "type": "int"}, + "headers": {"key": "matches.headers", "type": "[HeaderMatch]"}, + "http_status_codes": {"key": "matches.httpStatusCodes", "type": "[int]"}, + "errors": {"key": "matches.errors", "type": "[str]"}, + "initial_delay_in_milliseconds": {"key": "retryBackOff.initialDelayInMilliseconds", "type": "int"}, + "max_interval_in_milliseconds": {"key": "retryBackOff.maxIntervalInMilliseconds", "type": "int"}, } def __init__( self, *, - azure_active_directory: Optional["_models.AzureActiveDirectory"] = None, - facebook: Optional["_models.Facebook"] = None, - git_hub: Optional["_models.GitHub"] = None, - google: Optional["_models.Google"] = None, - twitter: Optional["_models.Twitter"] = None, - apple: Optional["_models.Apple"] = None, - azure_static_web_apps: Optional["_models.AzureStaticWebApps"] = None, - custom_open_id_connect_providers: Optional[Dict[str, "_models.CustomOpenIdConnectProvider"]] = None, + max_retries: Optional[int] = None, + headers: Optional[List["_models.HeaderMatch"]] = None, + http_status_codes: Optional[List[int]] = None, + errors: Optional[List[str]] = None, + initial_delay_in_milliseconds: Optional[int] = None, + max_interval_in_milliseconds: Optional[int] = None, **kwargs: Any ) -> None: """ - :keyword azure_active_directory: The configuration settings of the Azure Active directory - provider. - :paramtype azure_active_directory: ~azure.mgmt.appcontainers.models.AzureActiveDirectory - :keyword facebook: The configuration settings of the Facebook provider. - :paramtype facebook: ~azure.mgmt.appcontainers.models.Facebook - :keyword git_hub: The configuration settings of the GitHub provider. - :paramtype git_hub: ~azure.mgmt.appcontainers.models.GitHub - :keyword google: The configuration settings of the Google provider. - :paramtype google: ~azure.mgmt.appcontainers.models.Google - :keyword twitter: The configuration settings of the Twitter provider. - :paramtype twitter: ~azure.mgmt.appcontainers.models.Twitter - :keyword apple: The configuration settings of the Apple provider. - :paramtype apple: ~azure.mgmt.appcontainers.models.Apple - :keyword azure_static_web_apps: The configuration settings of the Azure Static Web Apps - provider. - :paramtype azure_static_web_apps: ~azure.mgmt.appcontainers.models.AzureStaticWebApps - :keyword custom_open_id_connect_providers: The map of the name of the alias of each custom Open - ID Connect provider to the - configuration settings of the custom Open ID Connect provider. - :paramtype custom_open_id_connect_providers: dict[str, - ~azure.mgmt.appcontainers.models.CustomOpenIdConnectProvider] + :keyword max_retries: Maximum number of times a request will retry. + :paramtype max_retries: int + :keyword headers: Headers that must be present for a request to be retried. + :paramtype headers: list[~azure.mgmt.appcontainers.models.HeaderMatch] + :keyword http_status_codes: Additional http status codes that can trigger a retry. + :paramtype http_status_codes: list[int] + :keyword errors: Errors that can trigger a retry. + :paramtype errors: list[str] + :keyword initial_delay_in_milliseconds: Initial delay, in milliseconds, before retrying a + request. + :paramtype initial_delay_in_milliseconds: int + :keyword max_interval_in_milliseconds: Maximum interval, in milliseconds, between retries. + :paramtype max_interval_in_milliseconds: int """ super().__init__(**kwargs) - self.azure_active_directory = azure_active_directory - self.facebook = facebook - self.git_hub = git_hub - self.google = google - self.twitter = twitter - self.apple = apple - self.azure_static_web_apps = azure_static_web_apps - self.custom_open_id_connect_providers = custom_open_id_connect_providers - + self.max_retries = max_retries + self.headers = headers + self.http_status_codes = http_status_codes + self.errors = errors + self.initial_delay_in_milliseconds = initial_delay_in_milliseconds + self.max_interval_in_milliseconds = max_interval_in_milliseconds -class IdentitySettings(_serialization.Model): - """Optional settings for a Managed Identity that is assigned to the Container App. - All required parameters must be populated in order to send to server. +class HttpRoute(_serialization.Model): + """Http Routes configuration, including paths to match on and whether or not rewrites are to be + done. - :ivar identity: The resource ID of a user-assigned managed identity that is assigned to the - Container App, or 'system' for system-assigned identity. Required. - :vartype identity: str - :ivar lifecycle: Use to select the lifecycle stages of a Container App during which the Managed - Identity should be available. Known values are: "Init", "Main", "None", and "All". - :vartype lifecycle: str or ~azure.mgmt.appcontainers.models.IdentitySettingsLifeCycle + :ivar match: Conditions route will match on. + :vartype match: ~azure.mgmt.appcontainers.models.HttpRouteMatch + :ivar action: Once route is matched, what is the desired action. + :vartype action: ~azure.mgmt.appcontainers.models.HttpRouteAction """ - _validation = { - "identity": {"required": True}, - } - _attribute_map = { - "identity": {"key": "identity", "type": "str"}, - "lifecycle": {"key": "lifecycle", "type": "str"}, + "match": {"key": "match", "type": "HttpRouteMatch"}, + "action": {"key": "action", "type": "HttpRouteAction"}, } def __init__( self, *, - identity: str, - lifecycle: Optional[Union[str, "_models.IdentitySettingsLifeCycle"]] = None, + match: Optional["_models.HttpRouteMatch"] = None, + action: Optional["_models.HttpRouteAction"] = None, **kwargs: Any ) -> None: """ - :keyword identity: The resource ID of a user-assigned managed identity that is assigned to the - Container App, or 'system' for system-assigned identity. Required. - :paramtype identity: str - :keyword lifecycle: Use to select the lifecycle stages of a Container App during which the - Managed Identity should be available. Known values are: "Init", "Main", "None", and "All". - :paramtype lifecycle: str or ~azure.mgmt.appcontainers.models.IdentitySettingsLifeCycle + :keyword match: Conditions route will match on. + :paramtype match: ~azure.mgmt.appcontainers.models.HttpRouteMatch + :keyword action: Once route is matched, what is the desired action. + :paramtype action: ~azure.mgmt.appcontainers.models.HttpRouteAction """ super().__init__(**kwargs) - self.identity = identity - self.lifecycle = lifecycle - + self.match = match + self.action = action -class Ingress(_serialization.Model): - """Container App Ingress configuration. - Variables are only populated by the server, and will be ignored when sending a request. +class HttpRouteAction(_serialization.Model): + """Action to perform once matching of routes is done. - :ivar fqdn: Hostname. - :vartype fqdn: str - :ivar external: Bool indicating if app exposes an external http endpoint. - :vartype external: bool - :ivar target_port: Target Port in containers for traffic from ingress. - :vartype target_port: int - :ivar exposed_port: Exposed Port in containers for TCP traffic from ingress. - :vartype exposed_port: int - :ivar transport: Ingress transport protocol. Known values are: "auto", "http", "http2", and - "tcp". - :vartype transport: str or ~azure.mgmt.appcontainers.models.IngressTransportMethod - :ivar traffic: Traffic weights for app's revisions. - :vartype traffic: list[~azure.mgmt.appcontainers.models.TrafficWeight] - :ivar custom_domains: custom domain bindings for Container Apps' hostnames. - :vartype custom_domains: list[~azure.mgmt.appcontainers.models.CustomDomain] - :ivar allow_insecure: Bool indicating if HTTP connections to is allowed. If set to false HTTP - connections are automatically redirected to HTTPS connections. - :vartype allow_insecure: bool - :ivar ip_security_restrictions: Rules to restrict incoming IP address. - :vartype ip_security_restrictions: - list[~azure.mgmt.appcontainers.models.IpSecurityRestrictionRule] - :ivar sticky_sessions: Sticky Sessions for Single Revision Mode. - :vartype sticky_sessions: ~azure.mgmt.appcontainers.models.IngressStickySessions - :ivar client_certificate_mode: Client certificate mode for mTLS authentication. Ignore - indicates server drops client certificate on forwarding. Accept indicates server forwards - client certificate but does not require a client certificate. Require indicates server requires - a client certificate. Known values are: "ignore", "accept", and "require". - :vartype client_certificate_mode: str or - ~azure.mgmt.appcontainers.models.IngressClientCertificateMode - :ivar cors_policy: CORS policy for container app. - :vartype cors_policy: ~azure.mgmt.appcontainers.models.CorsPolicy - :ivar additional_port_mappings: Settings to expose additional ports on container app. - :vartype additional_port_mappings: list[~azure.mgmt.appcontainers.models.IngressPortMapping] + :ivar prefix_rewrite: Rewrite prefix, default is no rewrites. + :vartype prefix_rewrite: str """ - _validation = { - "fqdn": {"readonly": True}, - } - _attribute_map = { - "fqdn": {"key": "fqdn", "type": "str"}, - "external": {"key": "external", "type": "bool"}, - "target_port": {"key": "targetPort", "type": "int"}, - "exposed_port": {"key": "exposedPort", "type": "int"}, - "transport": {"key": "transport", "type": "str"}, - "traffic": {"key": "traffic", "type": "[TrafficWeight]"}, - "custom_domains": {"key": "customDomains", "type": "[CustomDomain]"}, - "allow_insecure": {"key": "allowInsecure", "type": "bool"}, - "ip_security_restrictions": {"key": "ipSecurityRestrictions", "type": "[IpSecurityRestrictionRule]"}, - "sticky_sessions": {"key": "stickySessions", "type": "IngressStickySessions"}, - "client_certificate_mode": {"key": "clientCertificateMode", "type": "str"}, - "cors_policy": {"key": "corsPolicy", "type": "CorsPolicy"}, - "additional_port_mappings": {"key": "additionalPortMappings", "type": "[IngressPortMapping]"}, + "prefix_rewrite": {"key": "prefixRewrite", "type": "str"}, } - def __init__( - self, - *, - external: bool = False, - target_port: Optional[int] = None, - exposed_port: Optional[int] = None, - transport: Union[str, "_models.IngressTransportMethod"] = "auto", - traffic: Optional[List["_models.TrafficWeight"]] = None, - custom_domains: Optional[List["_models.CustomDomain"]] = None, - allow_insecure: bool = False, - ip_security_restrictions: Optional[List["_models.IpSecurityRestrictionRule"]] = None, - sticky_sessions: Optional["_models.IngressStickySessions"] = None, - client_certificate_mode: Optional[Union[str, "_models.IngressClientCertificateMode"]] = None, - cors_policy: Optional["_models.CorsPolicy"] = None, - additional_port_mappings: Optional[List["_models.IngressPortMapping"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword external: Bool indicating if app exposes an external http endpoint. - :paramtype external: bool - :keyword target_port: Target Port in containers for traffic from ingress. - :paramtype target_port: int - :keyword exposed_port: Exposed Port in containers for TCP traffic from ingress. - :paramtype exposed_port: int - :keyword transport: Ingress transport protocol. Known values are: "auto", "http", "http2", and - "tcp". - :paramtype transport: str or ~azure.mgmt.appcontainers.models.IngressTransportMethod - :keyword traffic: Traffic weights for app's revisions. - :paramtype traffic: list[~azure.mgmt.appcontainers.models.TrafficWeight] - :keyword custom_domains: custom domain bindings for Container Apps' hostnames. - :paramtype custom_domains: list[~azure.mgmt.appcontainers.models.CustomDomain] - :keyword allow_insecure: Bool indicating if HTTP connections to is allowed. If set to false - HTTP connections are automatically redirected to HTTPS connections. - :paramtype allow_insecure: bool - :keyword ip_security_restrictions: Rules to restrict incoming IP address. - :paramtype ip_security_restrictions: - list[~azure.mgmt.appcontainers.models.IpSecurityRestrictionRule] - :keyword sticky_sessions: Sticky Sessions for Single Revision Mode. - :paramtype sticky_sessions: ~azure.mgmt.appcontainers.models.IngressStickySessions - :keyword client_certificate_mode: Client certificate mode for mTLS authentication. Ignore - indicates server drops client certificate on forwarding. Accept indicates server forwards - client certificate but does not require a client certificate. Require indicates server requires - a client certificate. Known values are: "ignore", "accept", and "require". - :paramtype client_certificate_mode: str or - ~azure.mgmt.appcontainers.models.IngressClientCertificateMode - :keyword cors_policy: CORS policy for container app. - :paramtype cors_policy: ~azure.mgmt.appcontainers.models.CorsPolicy - :keyword additional_port_mappings: Settings to expose additional ports on container app. - :paramtype additional_port_mappings: list[~azure.mgmt.appcontainers.models.IngressPortMapping] - """ - super().__init__(**kwargs) - self.fqdn = None - self.external = external - self.target_port = target_port - self.exposed_port = exposed_port - self.transport = transport - self.traffic = traffic - self.custom_domains = custom_domains - self.allow_insecure = allow_insecure - self.ip_security_restrictions = ip_security_restrictions - self.sticky_sessions = sticky_sessions - self.client_certificate_mode = client_certificate_mode - self.cors_policy = cors_policy - self.additional_port_mappings = additional_port_mappings - - -class IngressPortMapping(_serialization.Model): - """Port mappings of container app ingress. - - All required parameters must be populated in order to send to server. - - :ivar external: Specifies whether the app port is accessible outside of the environment. - Required. - :vartype external: bool - :ivar target_port: Specifies the port user's container listens on. Required. - :vartype target_port: int - :ivar exposed_port: Specifies the exposed port for the target port. If not specified, it - defaults to target port. - :vartype exposed_port: int - """ - - _validation = { - "external": {"required": True}, - "target_port": {"required": True}, - } - - _attribute_map = { - "external": {"key": "external", "type": "bool"}, - "target_port": {"key": "targetPort", "type": "int"}, - "exposed_port": {"key": "exposedPort", "type": "int"}, - } - - def __init__(self, *, external: bool, target_port: int, exposed_port: Optional[int] = None, **kwargs: Any) -> None: - """ - :keyword external: Specifies whether the app port is accessible outside of the environment. - Required. - :paramtype external: bool - :keyword target_port: Specifies the port user's container listens on. Required. - :paramtype target_port: int - :keyword exposed_port: Specifies the exposed port for the target port. If not specified, it - defaults to target port. - :paramtype exposed_port: int - """ - super().__init__(**kwargs) - self.external = external - self.target_port = target_port - self.exposed_port = exposed_port - - -class IngressStickySessions(_serialization.Model): - """Sticky Sessions for Single Revision Mode. - - :ivar affinity: Sticky Session Affinity. Known values are: "sticky" and "none". - :vartype affinity: str or ~azure.mgmt.appcontainers.models.Affinity - """ - - _attribute_map = { - "affinity": {"key": "affinity", "type": "str"}, - } - - def __init__(self, *, affinity: Optional[Union[str, "_models.Affinity"]] = None, **kwargs: Any) -> None: - """ - :keyword affinity: Sticky Session Affinity. Known values are: "sticky" and "none". - :paramtype affinity: str or ~azure.mgmt.appcontainers.models.Affinity - """ - super().__init__(**kwargs) - self.affinity = affinity - - -class InitContainer(BaseContainer): - """Container App init container definition. - - :ivar image: Container image tag. - :vartype image: str - :ivar name: Custom container name. - :vartype name: str - :ivar command: Container start command. - :vartype command: list[str] - :ivar args: Container start command arguments. - :vartype args: list[str] - :ivar env: Container environment variables. - :vartype env: list[~azure.mgmt.appcontainers.models.EnvironmentVar] - :ivar resources: Container resource requirements. - :vartype resources: ~azure.mgmt.appcontainers.models.ContainerResources - :ivar volume_mounts: Container volume mounts. - :vartype volume_mounts: list[~azure.mgmt.appcontainers.models.VolumeMount] - """ - - -class IpSecurityRestrictionRule(_serialization.Model): - """Rule to restrict incoming IP address. - - All required parameters must be populated in order to send to server. - - :ivar name: Name for the IP restriction rule. Required. - :vartype name: str - :ivar description: Describe the IP restriction rule that is being sent to the container-app. - This is an optional field. - :vartype description: str - :ivar ip_address_range: CIDR notation to match incoming IP address. Required. - :vartype ip_address_range: str - :ivar action: Allow or Deny rules to determine for incoming IP. Note: Rules can only consist of - ALL Allow or ALL Deny. Required. Known values are: "Allow" and "Deny". - :vartype action: str or ~azure.mgmt.appcontainers.models.Action - """ - - _validation = { - "name": {"required": True}, - "ip_address_range": {"required": True}, - "action": {"required": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "description": {"key": "description", "type": "str"}, - "ip_address_range": {"key": "ipAddressRange", "type": "str"}, - "action": {"key": "action", "type": "str"}, - } - - def __init__( - self, - *, - name: str, - ip_address_range: str, - action: Union[str, "_models.Action"], - description: Optional[str] = None, - **kwargs: Any - ) -> None: + def __init__(self, *, prefix_rewrite: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword name: Name for the IP restriction rule. Required. - :paramtype name: str - :keyword description: Describe the IP restriction rule that is being sent to the container-app. - This is an optional field. - :paramtype description: str - :keyword ip_address_range: CIDR notation to match incoming IP address. Required. - :paramtype ip_address_range: str - :keyword action: Allow or Deny rules to determine for incoming IP. Note: Rules can only consist - of ALL Allow or ALL Deny. Required. Known values are: "Allow" and "Deny". - :paramtype action: str or ~azure.mgmt.appcontainers.models.Action + :keyword prefix_rewrite: Rewrite prefix, default is no rewrites. + :paramtype prefix_rewrite: str """ super().__init__(**kwargs) - self.name = name - self.description = description - self.ip_address_range = ip_address_range - self.action = action + self.prefix_rewrite = prefix_rewrite -class JavaComponent(ProxyResource): - """Java Component. +class HttpRouteConfig(ProxyResource): + """Advanced Ingress routing for path/header based routing for a Container App Environment. Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -5267,8 +7479,8 @@ class JavaComponent(ProxyResource): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData - :ivar properties: Java Component resource specific properties. - :vartype properties: ~azure.mgmt.appcontainers.models.JavaComponentProperties + :ivar properties: Http Route Config properties. + :vartype properties: ~azure.mgmt.appcontainers.models.HttpRouteConfigProperties """ _validation = { @@ -5283,672 +7495,806 @@ class JavaComponent(ProxyResource): "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, "system_data": {"key": "systemData", "type": "SystemData"}, - "properties": {"key": "properties", "type": "JavaComponentProperties"}, + "properties": {"key": "properties", "type": "HttpRouteConfigProperties"}, } - def __init__(self, *, properties: Optional["_models.JavaComponentProperties"] = None, **kwargs: Any) -> None: + def __init__(self, *, properties: Optional["_models.HttpRouteConfigProperties"] = None, **kwargs: Any) -> None: """ - :keyword properties: Java Component resource specific properties. - :paramtype properties: ~azure.mgmt.appcontainers.models.JavaComponentProperties + :keyword properties: Http Route Config properties. + :paramtype properties: ~azure.mgmt.appcontainers.models.HttpRouteConfigProperties """ super().__init__(**kwargs) self.properties = properties -class JavaComponentConfigurationProperty(_serialization.Model): - """Configuration properties for a Java Component. +class HttpRouteConfigCollection(_serialization.Model): + """Collection of Advanced Ingress Routing Config resources. - :ivar property_name: The name of the property. - :vartype property_name: str - :ivar value: The value of the property. - :vartype value: str + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar value: Collection of resources. Required. + :vartype value: list[~azure.mgmt.appcontainers.models.HttpRouteConfig] + :ivar next_link: Link to next page of resources. + :vartype next_link: str """ + _validation = { + "value": {"required": True}, + "next_link": {"readonly": True}, + } + _attribute_map = { - "property_name": {"key": "propertyName", "type": "str"}, - "value": {"key": "value", "type": "str"}, + "value": {"key": "value", "type": "[HttpRouteConfig]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, property_name: Optional[str] = None, value: Optional[str] = None, **kwargs: Any) -> None: + def __init__(self, *, value: List["_models.HttpRouteConfig"], **kwargs: Any) -> None: """ - :keyword property_name: The name of the property. - :paramtype property_name: str - :keyword value: The value of the property. - :paramtype value: str + :keyword value: Collection of resources. Required. + :paramtype value: list[~azure.mgmt.appcontainers.models.HttpRouteConfig] """ super().__init__(**kwargs) - self.property_name = property_name self.value = value + self.next_link: Optional[str] = None -class JavaComponentIngress(_serialization.Model): - """Container App Ingress configuration. +class HttpRouteConfigProperties(_serialization.Model): + """Http Route Config properties. Variables are only populated by the server, and will be ignored when sending a request. - :ivar fqdn: Hostname of the Java Component endpoint. + :ivar provisioning_state: The provisioning state of the Http Route Config in cluster. Known + values are: "Succeeded", "Failed", "Canceled", "Waiting", "Updating", "Deleting", and + "Pending". + :vartype provisioning_state: str or ~azure.mgmt.appcontainers.models.HttpRouteProvisioningState + :ivar provisioning_errors: List of errors when trying to reconcile http routes. + :vartype provisioning_errors: + list[~azure.mgmt.appcontainers.models.HttpRouteProvisioningErrors] + :ivar fqdn: FQDN of the route resource. :vartype fqdn: str + :ivar custom_domains: Custom domain bindings for http Routes' hostnames. + :vartype custom_domains: list[~azure.mgmt.appcontainers.models.CustomDomain] + :ivar rules: Routing Rules for http route resource. + :vartype rules: list[~azure.mgmt.appcontainers.models.HttpRouteRule] """ _validation = { + "provisioning_state": {"readonly": True}, + "provisioning_errors": {"readonly": True}, "fqdn": {"readonly": True}, } _attribute_map = { + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "provisioning_errors": {"key": "provisioningErrors", "type": "[HttpRouteProvisioningErrors]"}, "fqdn": {"key": "fqdn", "type": "str"}, + "custom_domains": {"key": "customDomains", "type": "[CustomDomain]"}, + "rules": {"key": "rules", "type": "[HttpRouteRule]"}, } - def __init__(self, **kwargs: Any) -> None: - """ """ + def __init__( + self, + *, + custom_domains: Optional[List["_models.CustomDomain"]] = None, + rules: Optional[List["_models.HttpRouteRule"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword custom_domains: Custom domain bindings for http Routes' hostnames. + :paramtype custom_domains: list[~azure.mgmt.appcontainers.models.CustomDomain] + :keyword rules: Routing Rules for http route resource. + :paramtype rules: list[~azure.mgmt.appcontainers.models.HttpRouteRule] + """ super().__init__(**kwargs) - self.fqdn = None + self.provisioning_state: Optional[Union[str, "_models.HttpRouteProvisioningState"]] = None + self.provisioning_errors: Optional[List["_models.HttpRouteProvisioningErrors"]] = None + self.fqdn: Optional[str] = None + self.custom_domains = custom_domains + self.rules = rules -class JavaComponentProperties(_serialization.Model): - """Java Component common properties. +class HttpRouteMatch(_serialization.Model): + """Criteria to match on. - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - SpringBootAdminComponent, SpringCloudConfigComponent, SpringCloudEurekaComponent - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar component_type: Type of the Java Component. Required. Known values are: - "SpringBootAdmin", "SpringCloudEureka", and "SpringCloudConfig". - :vartype component_type: str or ~azure.mgmt.appcontainers.models.JavaComponentType - :ivar provisioning_state: Provisioning state of the Java Component. Known values are: - "Succeeded", "Failed", "Canceled", "Deleting", and "InProgress". - :vartype provisioning_state: str or - ~azure.mgmt.appcontainers.models.JavaComponentProvisioningState - :ivar configurations: List of Java Components configuration properties. - :vartype configurations: - list[~azure.mgmt.appcontainers.models.JavaComponentConfigurationProperty] - :ivar scale: Java component scaling configurations. - :vartype scale: ~azure.mgmt.appcontainers.models.JavaComponentPropertiesScale - :ivar service_binds: List of Java Components that are bound to the Java component. - :vartype service_binds: list[~azure.mgmt.appcontainers.models.JavaComponentServiceBind] - """ - - _validation = { - "component_type": {"required": True}, - "provisioning_state": {"readonly": True}, - } + :ivar prefix: match on all prefix's. Not exact. + :vartype prefix: str + :ivar path: match on exact path. + :vartype path: str + :ivar path_separated_prefix: match on all prefix's. Not exact. + :vartype path_separated_prefix: str + :ivar case_sensitive: path case sensitive, default is true. + :vartype case_sensitive: bool + """ _attribute_map = { - "component_type": {"key": "componentType", "type": "str"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "configurations": {"key": "configurations", "type": "[JavaComponentConfigurationProperty]"}, - "scale": {"key": "scale", "type": "JavaComponentPropertiesScale"}, - "service_binds": {"key": "serviceBinds", "type": "[JavaComponentServiceBind]"}, - } - - _subtype_map = { - "component_type": { - "SpringBootAdmin": "SpringBootAdminComponent", - "SpringCloudConfig": "SpringCloudConfigComponent", - "SpringCloudEureka": "SpringCloudEurekaComponent", - } + "prefix": {"key": "prefix", "type": "str"}, + "path": {"key": "path", "type": "str"}, + "path_separated_prefix": {"key": "pathSeparatedPrefix", "type": "str"}, + "case_sensitive": {"key": "caseSensitive", "type": "bool"}, } def __init__( self, *, - configurations: Optional[List["_models.JavaComponentConfigurationProperty"]] = None, - scale: Optional["_models.JavaComponentPropertiesScale"] = None, - service_binds: Optional[List["_models.JavaComponentServiceBind"]] = None, + prefix: Optional[str] = None, + path: Optional[str] = None, + path_separated_prefix: Optional[str] = None, + case_sensitive: Optional[bool] = None, **kwargs: Any ) -> None: """ - :keyword configurations: List of Java Components configuration properties. - :paramtype configurations: - list[~azure.mgmt.appcontainers.models.JavaComponentConfigurationProperty] - :keyword scale: Java component scaling configurations. - :paramtype scale: ~azure.mgmt.appcontainers.models.JavaComponentPropertiesScale - :keyword service_binds: List of Java Components that are bound to the Java component. - :paramtype service_binds: list[~azure.mgmt.appcontainers.models.JavaComponentServiceBind] + :keyword prefix: match on all prefix's. Not exact. + :paramtype prefix: str + :keyword path: match on exact path. + :paramtype path: str + :keyword path_separated_prefix: match on all prefix's. Not exact. + :paramtype path_separated_prefix: str + :keyword case_sensitive: path case sensitive, default is true. + :paramtype case_sensitive: bool """ super().__init__(**kwargs) - self.component_type: Optional[str] = None - self.provisioning_state = None - self.configurations = configurations - self.scale = scale - self.service_binds = service_binds + self.prefix = prefix + self.path = path + self.path_separated_prefix = path_separated_prefix + self.case_sensitive = case_sensitive -class JavaComponentPropertiesScale(_serialization.Model): - """Java component scaling configurations. +class HttpRouteProvisioningErrors(_serialization.Model): + """List of provisioning errors for a http route config object. - :ivar min_replicas: Optional. Minimum number of Java component replicas. Defaults to 1 if not - set. - :vartype min_replicas: int - :ivar max_replicas: Optional. Maximum number of Java component replicas. - :vartype max_replicas: int + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar timestamp: Timestamp error occured at. + :vartype timestamp: ~datetime.datetime + :ivar message: Description or error message. + :vartype message: str """ + _validation = { + "timestamp": {"readonly": True}, + "message": {"readonly": True}, + } + _attribute_map = { - "min_replicas": {"key": "minReplicas", "type": "int"}, - "max_replicas": {"key": "maxReplicas", "type": "int"}, + "timestamp": {"key": "timestamp", "type": "iso-8601"}, + "message": {"key": "message", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.timestamp: Optional[datetime.datetime] = None + self.message: Optional[str] = None + + +class HttpRouteRule(_serialization.Model): + """Http Route rule. + + :ivar targets: Targets- container apps, revisions, labels. + :vartype targets: list[~azure.mgmt.appcontainers.models.HttpRouteTarget] + :ivar routes: Routing configuration that will allow matches on specific paths/headers. + :vartype routes: list[~azure.mgmt.appcontainers.models.HttpRoute] + :ivar description: Description of rule. Optional. + :vartype description: str + """ + + _attribute_map = { + "targets": {"key": "targets", "type": "[HttpRouteTarget]"}, + "routes": {"key": "routes", "type": "[HttpRoute]"}, + "description": {"key": "description", "type": "str"}, } def __init__( - self, *, min_replicas: Optional[int] = None, max_replicas: Optional[int] = None, **kwargs: Any + self, + *, + targets: Optional[List["_models.HttpRouteTarget"]] = None, + routes: Optional[List["_models.HttpRoute"]] = None, + description: Optional[str] = None, + **kwargs: Any ) -> None: """ - :keyword min_replicas: Optional. Minimum number of Java component replicas. Defaults to 1 if - not set. - :paramtype min_replicas: int - :keyword max_replicas: Optional. Maximum number of Java component replicas. - :paramtype max_replicas: int + :keyword targets: Targets- container apps, revisions, labels. + :paramtype targets: list[~azure.mgmt.appcontainers.models.HttpRouteTarget] + :keyword routes: Routing configuration that will allow matches on specific paths/headers. + :paramtype routes: list[~azure.mgmt.appcontainers.models.HttpRoute] + :keyword description: Description of rule. Optional. + :paramtype description: str """ super().__init__(**kwargs) - self.min_replicas = min_replicas - self.max_replicas = max_replicas - + self.targets = targets + self.routes = routes + self.description = description -class JavaComponentsCollection(_serialization.Model): - """Java Components ARM resource. - Variables are only populated by the server, and will be ignored when sending a request. +class HttpRouteTarget(_serialization.Model): + """Targets - Container App Names, Revision Names, Labels. All required parameters must be populated in order to send to server. - :ivar value: Collection of resources. Required. - :vartype value: list[~azure.mgmt.appcontainers.models.JavaComponent] - :ivar next_link: Link to next page of resources. - :vartype next_link: str + :ivar container_app: Container App Name to route requests to. Required. + :vartype container_app: str + :ivar revision: Revision to route requests to. + :vartype revision: str + :ivar label: Label/Revision to route requests to. + :vartype label: str + :ivar weight: Weighted routing. + :vartype weight: int """ _validation = { - "value": {"required": True}, - "next_link": {"readonly": True}, + "container_app": {"required": True}, + "weight": {"maximum": 100, "minimum": 0}, } _attribute_map = { - "value": {"key": "value", "type": "[JavaComponent]"}, - "next_link": {"key": "nextLink", "type": "str"}, + "container_app": {"key": "containerApp", "type": "str"}, + "revision": {"key": "revision", "type": "str"}, + "label": {"key": "label", "type": "str"}, + "weight": {"key": "weight", "type": "int"}, } - def __init__(self, *, value: List["_models.JavaComponent"], **kwargs: Any) -> None: + def __init__( + self, + *, + container_app: str, + revision: Optional[str] = None, + label: Optional[str] = None, + weight: Optional[int] = None, + **kwargs: Any + ) -> None: """ - :keyword value: Collection of resources. Required. - :paramtype value: list[~azure.mgmt.appcontainers.models.JavaComponent] + :keyword container_app: Container App Name to route requests to. Required. + :paramtype container_app: str + :keyword revision: Revision to route requests to. + :paramtype revision: str + :keyword label: Label/Revision to route requests to. + :paramtype label: str + :keyword weight: Weighted routing. + :paramtype weight: int """ super().__init__(**kwargs) - self.value = value - self.next_link = None + self.container_app = container_app + self.revision = revision + self.label = label + self.weight = weight -class JavaComponentServiceBind(_serialization.Model): - """Configuration to bind a Java Component to another Java Component. +class HttpScaleRule(_serialization.Model): + """Container App container Http scaling rule. - :ivar name: Name of the service bind. - :vartype name: str - :ivar service_id: Resource id of the target service. - :vartype service_id: str + :ivar metadata: Metadata properties to describe http scale rule. + :vartype metadata: dict[str, str] + :ivar auth: Authentication secrets for the custom scale rule. + :vartype auth: list[~azure.mgmt.appcontainers.models.ScaleRuleAuth] + :ivar identity: The resource ID of a user-assigned managed identity that is assigned to the + Container App, or 'system' for system-assigned identity. + :vartype identity: str """ _attribute_map = { - "name": {"key": "name", "type": "str"}, - "service_id": {"key": "serviceId", "type": "str"}, + "metadata": {"key": "metadata", "type": "{str}"}, + "auth": {"key": "auth", "type": "[ScaleRuleAuth]"}, + "identity": {"key": "identity", "type": "str"}, } - def __init__(self, *, name: Optional[str] = None, service_id: Optional[str] = None, **kwargs: Any) -> None: + def __init__( + self, + *, + metadata: Optional[Dict[str, str]] = None, + auth: Optional[List["_models.ScaleRuleAuth"]] = None, + identity: Optional[str] = None, + **kwargs: Any + ) -> None: """ - :keyword name: Name of the service bind. - :paramtype name: str - :keyword service_id: Resource id of the target service. - :paramtype service_id: str + :keyword metadata: Metadata properties to describe http scale rule. + :paramtype metadata: dict[str, str] + :keyword auth: Authentication secrets for the custom scale rule. + :paramtype auth: list[~azure.mgmt.appcontainers.models.ScaleRuleAuth] + :keyword identity: The resource ID of a user-assigned managed identity that is assigned to the + Container App, or 'system' for system-assigned identity. + :paramtype identity: str """ super().__init__(**kwargs) - self.name = name - self.service_id = service_id - - -class Job(TrackedResource): - """Container App Job. + self.metadata = metadata + self.auth = auth + self.identity = identity - Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to server. +class HttpSettings(_serialization.Model): + """The configuration settings of the HTTP requests for authentication and authorization requests + made against ContainerApp Service Authentication/Authorization. - :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar identity: Managed identities needed by a container app job to interact with other Azure - services to not maintain any secrets or credentials in code. - :vartype identity: ~azure.mgmt.appcontainers.models.ManagedServiceIdentity - :ivar provisioning_state: Provisioning state of the Container Apps Job. Known values are: - "InProgress", "Succeeded", "Failed", "Canceled", and "Deleting". - :vartype provisioning_state: str or ~azure.mgmt.appcontainers.models.JobProvisioningState - :ivar environment_id: Resource ID of environment. - :vartype environment_id: str - :ivar workload_profile_name: Workload profile name to pin for container apps job execution. - :vartype workload_profile_name: str - :ivar configuration: Container Apps Job configuration properties. - :vartype configuration: ~azure.mgmt.appcontainers.models.JobConfiguration - :ivar template: Container Apps job definition. - :vartype template: ~azure.mgmt.appcontainers.models.JobTemplate - :ivar outbound_ip_addresses: Outbound IP Addresses of a container apps job. - :vartype outbound_ip_addresses: list[str] - :ivar event_stream_endpoint: The endpoint of the eventstream of the container apps job. - :vartype event_stream_endpoint: str + :ivar require_https: :code:`false` if the authentication/authorization responses + not having the HTTPS scheme are permissible; otherwise, :code:`true`. + :vartype require_https: bool + :ivar routes: The configuration settings of the paths HTTP requests. + :vartype routes: ~azure.mgmt.appcontainers.models.HttpSettingsRoutes + :ivar forward_proxy: The configuration settings of a forward proxy used to make the requests. + :vartype forward_proxy: ~azure.mgmt.appcontainers.models.ForwardProxy """ - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "location": {"required": True}, - "provisioning_state": {"readonly": True}, - "outbound_ip_addresses": {"readonly": True}, - "event_stream_endpoint": {"readonly": True}, - } - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "environment_id": {"key": "properties.environmentId", "type": "str"}, - "workload_profile_name": {"key": "properties.workloadProfileName", "type": "str"}, - "configuration": {"key": "properties.configuration", "type": "JobConfiguration"}, - "template": {"key": "properties.template", "type": "JobTemplate"}, - "outbound_ip_addresses": {"key": "properties.outboundIpAddresses", "type": "[str]"}, - "event_stream_endpoint": {"key": "properties.eventStreamEndpoint", "type": "str"}, + "require_https": {"key": "requireHttps", "type": "bool"}, + "routes": {"key": "routes", "type": "HttpSettingsRoutes"}, + "forward_proxy": {"key": "forwardProxy", "type": "ForwardProxy"}, } def __init__( self, *, - location: str, - tags: Optional[Dict[str, str]] = None, - identity: Optional["_models.ManagedServiceIdentity"] = None, - environment_id: Optional[str] = None, - workload_profile_name: Optional[str] = None, - configuration: Optional["_models.JobConfiguration"] = None, - template: Optional["_models.JobTemplate"] = None, + require_https: Optional[bool] = None, + routes: Optional["_models.HttpSettingsRoutes"] = None, + forward_proxy: Optional["_models.ForwardProxy"] = None, **kwargs: Any ) -> None: """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - :keyword identity: Managed identities needed by a container app job to interact with other - Azure services to not maintain any secrets or credentials in code. - :paramtype identity: ~azure.mgmt.appcontainers.models.ManagedServiceIdentity - :keyword environment_id: Resource ID of environment. - :paramtype environment_id: str - :keyword workload_profile_name: Workload profile name to pin for container apps job execution. - :paramtype workload_profile_name: str - :keyword configuration: Container Apps Job configuration properties. - :paramtype configuration: ~azure.mgmt.appcontainers.models.JobConfiguration - :keyword template: Container Apps job definition. - :paramtype template: ~azure.mgmt.appcontainers.models.JobTemplate + :keyword require_https: :code:`false` if the authentication/authorization + responses not having the HTTPS scheme are permissible; otherwise, :code:`true`. + :paramtype require_https: bool + :keyword routes: The configuration settings of the paths HTTP requests. + :paramtype routes: ~azure.mgmt.appcontainers.models.HttpSettingsRoutes + :keyword forward_proxy: The configuration settings of a forward proxy used to make the + requests. + :paramtype forward_proxy: ~azure.mgmt.appcontainers.models.ForwardProxy """ - super().__init__(tags=tags, location=location, **kwargs) - self.identity = identity - self.provisioning_state = None - self.environment_id = environment_id - self.workload_profile_name = workload_profile_name - self.configuration = configuration - self.template = template - self.outbound_ip_addresses = None - self.event_stream_endpoint = None - + super().__init__(**kwargs) + self.require_https = require_https + self.routes = routes + self.forward_proxy = forward_proxy -class JobConfiguration(_serialization.Model): - """Non versioned Container Apps Job configuration properties. - All required parameters must be populated in order to send to server. +class HttpSettingsRoutes(_serialization.Model): + """The configuration settings of the paths HTTP requests. - :ivar secrets: Collection of secrets used by a Container Apps Job. - :vartype secrets: list[~azure.mgmt.appcontainers.models.Secret] - :ivar trigger_type: Trigger type of the job. Known values are: "Schedule", "Event", and - "Manual". - :vartype trigger_type: str or ~azure.mgmt.appcontainers.models.TriggerType - :ivar replica_timeout: Maximum number of seconds a replica is allowed to run. Required. - :vartype replica_timeout: int - :ivar replica_retry_limit: Maximum number of retries before failing the job. - :vartype replica_retry_limit: int - :ivar manual_trigger_config: Manual trigger configuration for a single execution job. - Properties replicaCompletionCount and parallelism would be set to 1 by default. - :vartype manual_trigger_config: - ~azure.mgmt.appcontainers.models.JobConfigurationManualTriggerConfig - :ivar schedule_trigger_config: Cron formatted repeating trigger schedule ("\\ * * * * *") for - cronjobs. Properties completions and parallelism would be set to 1 by default. - :vartype schedule_trigger_config: - ~azure.mgmt.appcontainers.models.JobConfigurationScheduleTriggerConfig - :ivar event_trigger_config: Trigger configuration of an event driven job. - :vartype event_trigger_config: - ~azure.mgmt.appcontainers.models.JobConfigurationEventTriggerConfig - :ivar registries: Collection of private container registry credentials used by a Container apps - job. - :vartype registries: list[~azure.mgmt.appcontainers.models.RegistryCredentials] - :ivar identity_settings: Optional settings for Managed Identities that are assigned to the - Container App Job. If a Managed Identity is not specified here, default settings will be used. - :vartype identity_settings: list[~azure.mgmt.appcontainers.models.IdentitySettings] + :ivar api_prefix: The prefix that should precede all the authentication/authorization paths. + :vartype api_prefix: str """ - _validation = { - "trigger_type": {"required": True}, - "replica_timeout": {"required": True}, - } - _attribute_map = { - "secrets": {"key": "secrets", "type": "[Secret]"}, - "trigger_type": {"key": "triggerType", "type": "str"}, - "replica_timeout": {"key": "replicaTimeout", "type": "int"}, - "replica_retry_limit": {"key": "replicaRetryLimit", "type": "int"}, - "manual_trigger_config": {"key": "manualTriggerConfig", "type": "JobConfigurationManualTriggerConfig"}, - "schedule_trigger_config": {"key": "scheduleTriggerConfig", "type": "JobConfigurationScheduleTriggerConfig"}, - "event_trigger_config": {"key": "eventTriggerConfig", "type": "JobConfigurationEventTriggerConfig"}, - "registries": {"key": "registries", "type": "[RegistryCredentials]"}, - "identity_settings": {"key": "identitySettings", "type": "[IdentitySettings]"}, + "api_prefix": {"key": "apiPrefix", "type": "str"}, } - def __init__( - self, - *, - trigger_type: Union[str, "_models.TriggerType"] = "Manual", - replica_timeout: int, - secrets: Optional[List["_models.Secret"]] = None, - replica_retry_limit: Optional[int] = None, - manual_trigger_config: Optional["_models.JobConfigurationManualTriggerConfig"] = None, - schedule_trigger_config: Optional["_models.JobConfigurationScheduleTriggerConfig"] = None, - event_trigger_config: Optional["_models.JobConfigurationEventTriggerConfig"] = None, - registries: Optional[List["_models.RegistryCredentials"]] = None, - identity_settings: Optional[List["_models.IdentitySettings"]] = None, - **kwargs: Any - ) -> None: + def __init__(self, *, api_prefix: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword secrets: Collection of secrets used by a Container Apps Job. - :paramtype secrets: list[~azure.mgmt.appcontainers.models.Secret] - :keyword trigger_type: Trigger type of the job. Known values are: "Schedule", "Event", and - "Manual". - :paramtype trigger_type: str or ~azure.mgmt.appcontainers.models.TriggerType - :keyword replica_timeout: Maximum number of seconds a replica is allowed to run. Required. - :paramtype replica_timeout: int - :keyword replica_retry_limit: Maximum number of retries before failing the job. - :paramtype replica_retry_limit: int - :keyword manual_trigger_config: Manual trigger configuration for a single execution job. - Properties replicaCompletionCount and parallelism would be set to 1 by default. - :paramtype manual_trigger_config: - ~azure.mgmt.appcontainers.models.JobConfigurationManualTriggerConfig - :keyword schedule_trigger_config: Cron formatted repeating trigger schedule ("\\ * * * * *") - for cronjobs. Properties completions and parallelism would be set to 1 by default. - :paramtype schedule_trigger_config: - ~azure.mgmt.appcontainers.models.JobConfigurationScheduleTriggerConfig - :keyword event_trigger_config: Trigger configuration of an event driven job. - :paramtype event_trigger_config: - ~azure.mgmt.appcontainers.models.JobConfigurationEventTriggerConfig - :keyword registries: Collection of private container registry credentials used by a Container - apps job. - :paramtype registries: list[~azure.mgmt.appcontainers.models.RegistryCredentials] - :keyword identity_settings: Optional settings for Managed Identities that are assigned to the - Container App Job. If a Managed Identity is not specified here, default settings will be used. - :paramtype identity_settings: list[~azure.mgmt.appcontainers.models.IdentitySettings] + :keyword api_prefix: The prefix that should precede all the authentication/authorization paths. + :paramtype api_prefix: str """ super().__init__(**kwargs) - self.secrets = secrets - self.trigger_type = trigger_type - self.replica_timeout = replica_timeout - self.replica_retry_limit = replica_retry_limit - self.manual_trigger_config = manual_trigger_config - self.schedule_trigger_config = schedule_trigger_config - self.event_trigger_config = event_trigger_config - self.registries = registries - self.identity_settings = identity_settings + self.api_prefix = api_prefix -class JobConfigurationEventTriggerConfig(_serialization.Model): - """Trigger configuration of an event driven job. +class IdentityProviders(_serialization.Model): + """The configuration settings of each of the identity providers used to configure ContainerApp + Service Authentication/Authorization. - :ivar replica_completion_count: Minimum number of successful replica completions before overall - job completion. - :vartype replica_completion_count: int - :ivar parallelism: Number of parallel replicas of a job that can run at a given time. - :vartype parallelism: int - :ivar scale: Scaling configurations for event driven jobs. - :vartype scale: ~azure.mgmt.appcontainers.models.JobScale + :ivar azure_active_directory: The configuration settings of the Azure Active directory + provider. + :vartype azure_active_directory: ~azure.mgmt.appcontainers.models.AzureActiveDirectory + :ivar facebook: The configuration settings of the Facebook provider. + :vartype facebook: ~azure.mgmt.appcontainers.models.Facebook + :ivar git_hub: The configuration settings of the GitHub provider. + :vartype git_hub: ~azure.mgmt.appcontainers.models.GitHub + :ivar google: The configuration settings of the Google provider. + :vartype google: ~azure.mgmt.appcontainers.models.Google + :ivar twitter: The configuration settings of the Twitter provider. + :vartype twitter: ~azure.mgmt.appcontainers.models.Twitter + :ivar apple: The configuration settings of the Apple provider. + :vartype apple: ~azure.mgmt.appcontainers.models.Apple + :ivar azure_static_web_apps: The configuration settings of the Azure Static Web Apps provider. + :vartype azure_static_web_apps: ~azure.mgmt.appcontainers.models.AzureStaticWebApps + :ivar custom_open_id_connect_providers: The map of the name of the alias of each custom Open ID + Connect provider to the + configuration settings of the custom Open ID Connect provider. + :vartype custom_open_id_connect_providers: dict[str, + ~azure.mgmt.appcontainers.models.CustomOpenIdConnectProvider] """ _attribute_map = { - "replica_completion_count": {"key": "replicaCompletionCount", "type": "int"}, - "parallelism": {"key": "parallelism", "type": "int"}, - "scale": {"key": "scale", "type": "JobScale"}, + "azure_active_directory": {"key": "azureActiveDirectory", "type": "AzureActiveDirectory"}, + "facebook": {"key": "facebook", "type": "Facebook"}, + "git_hub": {"key": "gitHub", "type": "GitHub"}, + "google": {"key": "google", "type": "Google"}, + "twitter": {"key": "twitter", "type": "Twitter"}, + "apple": {"key": "apple", "type": "Apple"}, + "azure_static_web_apps": {"key": "azureStaticWebApps", "type": "AzureStaticWebApps"}, + "custom_open_id_connect_providers": { + "key": "customOpenIdConnectProviders", + "type": "{CustomOpenIdConnectProvider}", + }, } def __init__( self, *, - replica_completion_count: Optional[int] = None, - parallelism: Optional[int] = None, - scale: Optional["_models.JobScale"] = None, + azure_active_directory: Optional["_models.AzureActiveDirectory"] = None, + facebook: Optional["_models.Facebook"] = None, + git_hub: Optional["_models.GitHub"] = None, + google: Optional["_models.Google"] = None, + twitter: Optional["_models.Twitter"] = None, + apple: Optional["_models.Apple"] = None, + azure_static_web_apps: Optional["_models.AzureStaticWebApps"] = None, + custom_open_id_connect_providers: Optional[Dict[str, "_models.CustomOpenIdConnectProvider"]] = None, **kwargs: Any ) -> None: """ - :keyword replica_completion_count: Minimum number of successful replica completions before - overall job completion. - :paramtype replica_completion_count: int - :keyword parallelism: Number of parallel replicas of a job that can run at a given time. - :paramtype parallelism: int - :keyword scale: Scaling configurations for event driven jobs. - :paramtype scale: ~azure.mgmt.appcontainers.models.JobScale + :keyword azure_active_directory: The configuration settings of the Azure Active directory + provider. + :paramtype azure_active_directory: ~azure.mgmt.appcontainers.models.AzureActiveDirectory + :keyword facebook: The configuration settings of the Facebook provider. + :paramtype facebook: ~azure.mgmt.appcontainers.models.Facebook + :keyword git_hub: The configuration settings of the GitHub provider. + :paramtype git_hub: ~azure.mgmt.appcontainers.models.GitHub + :keyword google: The configuration settings of the Google provider. + :paramtype google: ~azure.mgmt.appcontainers.models.Google + :keyword twitter: The configuration settings of the Twitter provider. + :paramtype twitter: ~azure.mgmt.appcontainers.models.Twitter + :keyword apple: The configuration settings of the Apple provider. + :paramtype apple: ~azure.mgmt.appcontainers.models.Apple + :keyword azure_static_web_apps: The configuration settings of the Azure Static Web Apps + provider. + :paramtype azure_static_web_apps: ~azure.mgmt.appcontainers.models.AzureStaticWebApps + :keyword custom_open_id_connect_providers: The map of the name of the alias of each custom Open + ID Connect provider to the + configuration settings of the custom Open ID Connect provider. + :paramtype custom_open_id_connect_providers: dict[str, + ~azure.mgmt.appcontainers.models.CustomOpenIdConnectProvider] """ super().__init__(**kwargs) - self.replica_completion_count = replica_completion_count - self.parallelism = parallelism - self.scale = scale + self.azure_active_directory = azure_active_directory + self.facebook = facebook + self.git_hub = git_hub + self.google = google + self.twitter = twitter + self.apple = apple + self.azure_static_web_apps = azure_static_web_apps + self.custom_open_id_connect_providers = custom_open_id_connect_providers -class JobConfigurationManualTriggerConfig(_serialization.Model): - """Manual trigger configuration for a single execution job. Properties replicaCompletionCount and - parallelism would be set to 1 by default. +class IdentitySettings(_serialization.Model): + """Optional settings for a Managed Identity that is assigned to the Container App. - :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 + All required parameters must be populated in order to send to server. + + :ivar identity: The resource ID of a user-assigned managed identity that is assigned to the + Container App, or 'system' for system-assigned identity. Required. + :vartype identity: str + :ivar lifecycle: Use to select the lifecycle stages of a Container App during which the Managed + Identity should be available. Known values are: "Init", "Main", "None", and "All". + :vartype lifecycle: str or ~azure.mgmt.appcontainers.models.IdentitySettingsLifeCycle """ - _attribute_map = { - "replica_completion_count": {"key": "replicaCompletionCount", "type": "int"}, - "parallelism": {"key": "parallelism", "type": "int"}, + _validation = { + "identity": {"required": True}, + } + + _attribute_map = { + "identity": {"key": "identity", "type": "str"}, + "lifecycle": {"key": "lifecycle", "type": "str"}, } def __init__( - self, *, replica_completion_count: Optional[int] = None, parallelism: Optional[int] = None, **kwargs: Any + self, + *, + identity: str, + lifecycle: Optional[Union[str, "_models.IdentitySettingsLifeCycle"]] = 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 identity: The resource ID of a user-assigned managed identity that is assigned to the + Container App, or 'system' for system-assigned identity. Required. + :paramtype identity: str + :keyword lifecycle: Use to select the lifecycle stages of a Container App during which the + Managed Identity should be available. Known values are: "Init", "Main", "None", and "All". + :paramtype lifecycle: str or ~azure.mgmt.appcontainers.models.IdentitySettingsLifeCycle """ super().__init__(**kwargs) - self.replica_completion_count = replica_completion_count - self.parallelism = parallelism + self.identity = identity + self.lifecycle = lifecycle -class JobConfigurationScheduleTriggerConfig(_serialization.Model): - """Cron formatted repeating trigger schedule ("\\ * * * * *") for cronjobs. Properties completions - and parallelism would be set to 1 by default. +class Ingress(_serialization.Model): + """Container App Ingress configuration. - All required parameters must be populated in order to send to server. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar replica_completion_count: Minimum number of successful replica completions before overall - job completion. - :vartype replica_completion_count: int - :ivar cron_expression: Cron formatted repeating schedule ("\\ * * * * *") of a Cron Job. - Required. - :vartype cron_expression: str - :ivar parallelism: Number of parallel replicas of a job that can run at a given time. - :vartype parallelism: int + :ivar fqdn: Hostname. + :vartype fqdn: str + :ivar external: Bool indicating if app exposes an external http endpoint. + :vartype external: bool + :ivar target_port: Target Port in containers for traffic from ingress. + :vartype target_port: int + :ivar exposed_port: Exposed Port in containers for TCP traffic from ingress. + :vartype exposed_port: int + :ivar transport: Ingress transport protocol. Known values are: "auto", "http", "http2", and + "tcp". + :vartype transport: str or ~azure.mgmt.appcontainers.models.IngressTransportMethod + :ivar traffic: Traffic weights for app's revisions. + :vartype traffic: list[~azure.mgmt.appcontainers.models.TrafficWeight] + :ivar custom_domains: custom domain bindings for Container Apps' hostnames. + :vartype custom_domains: list[~azure.mgmt.appcontainers.models.CustomDomain] + :ivar allow_insecure: Bool indicating if HTTP connections to is allowed. If set to false HTTP + connections are automatically redirected to HTTPS connections. + :vartype allow_insecure: bool + :ivar ip_security_restrictions: Rules to restrict incoming IP address. + :vartype ip_security_restrictions: + list[~azure.mgmt.appcontainers.models.IpSecurityRestrictionRule] + :ivar sticky_sessions: Sticky Sessions for Single Revision Mode. + :vartype sticky_sessions: ~azure.mgmt.appcontainers.models.IngressStickySessions + :ivar client_certificate_mode: Client certificate mode for mTLS authentication. Ignore + indicates server drops client certificate on forwarding. Accept indicates server forwards + client certificate but does not require a client certificate. Require indicates server requires + a client certificate. Known values are: "ignore", "accept", and "require". + :vartype client_certificate_mode: str or + ~azure.mgmt.appcontainers.models.IngressClientCertificateMode + :ivar cors_policy: CORS policy for container app. + :vartype cors_policy: ~azure.mgmt.appcontainers.models.CorsPolicy + :ivar additional_port_mappings: Settings to expose additional ports on container app. + :vartype additional_port_mappings: list[~azure.mgmt.appcontainers.models.IngressPortMapping] + :ivar target_port_http_scheme: Whether an http app listens on http or https. Known values are: + "http" and "https". + :vartype target_port_http_scheme: str or + ~azure.mgmt.appcontainers.models.IngressTargetPortHttpScheme """ _validation = { - "cron_expression": {"required": True}, + "fqdn": {"readonly": True}, } _attribute_map = { - "replica_completion_count": {"key": "replicaCompletionCount", "type": "int"}, - "cron_expression": {"key": "cronExpression", "type": "str"}, - "parallelism": {"key": "parallelism", "type": "int"}, + "fqdn": {"key": "fqdn", "type": "str"}, + "external": {"key": "external", "type": "bool"}, + "target_port": {"key": "targetPort", "type": "int"}, + "exposed_port": {"key": "exposedPort", "type": "int"}, + "transport": {"key": "transport", "type": "str"}, + "traffic": {"key": "traffic", "type": "[TrafficWeight]"}, + "custom_domains": {"key": "customDomains", "type": "[CustomDomain]"}, + "allow_insecure": {"key": "allowInsecure", "type": "bool"}, + "ip_security_restrictions": {"key": "ipSecurityRestrictions", "type": "[IpSecurityRestrictionRule]"}, + "sticky_sessions": {"key": "stickySessions", "type": "IngressStickySessions"}, + "client_certificate_mode": {"key": "clientCertificateMode", "type": "str"}, + "cors_policy": {"key": "corsPolicy", "type": "CorsPolicy"}, + "additional_port_mappings": {"key": "additionalPortMappings", "type": "[IngressPortMapping]"}, + "target_port_http_scheme": {"key": "targetPortHttpScheme", "type": "str"}, } def __init__( self, *, - cron_expression: str, - replica_completion_count: Optional[int] = None, - parallelism: Optional[int] = None, + external: bool = False, + target_port: Optional[int] = None, + exposed_port: Optional[int] = None, + transport: Union[str, "_models.IngressTransportMethod"] = "auto", + traffic: Optional[List["_models.TrafficWeight"]] = None, + custom_domains: Optional[List["_models.CustomDomain"]] = None, + allow_insecure: bool = False, + ip_security_restrictions: Optional[List["_models.IpSecurityRestrictionRule"]] = None, + sticky_sessions: Optional["_models.IngressStickySessions"] = None, + client_certificate_mode: Optional[Union[str, "_models.IngressClientCertificateMode"]] = None, + cors_policy: Optional["_models.CorsPolicy"] = None, + additional_port_mappings: Optional[List["_models.IngressPortMapping"]] = None, + target_port_http_scheme: Optional[Union[str, "_models.IngressTargetPortHttpScheme"]] = None, **kwargs: Any ) -> None: """ - :keyword replica_completion_count: Minimum number of successful replica completions before - overall job completion. - :paramtype replica_completion_count: int - :keyword cron_expression: Cron formatted repeating schedule ("\\ * * * * *") of a Cron Job. - Required. - :paramtype cron_expression: str - :keyword parallelism: Number of parallel replicas of a job that can run at a given time. - :paramtype parallelism: int + :keyword external: Bool indicating if app exposes an external http endpoint. + :paramtype external: bool + :keyword target_port: Target Port in containers for traffic from ingress. + :paramtype target_port: int + :keyword exposed_port: Exposed Port in containers for TCP traffic from ingress. + :paramtype exposed_port: int + :keyword transport: Ingress transport protocol. Known values are: "auto", "http", "http2", and + "tcp". + :paramtype transport: str or ~azure.mgmt.appcontainers.models.IngressTransportMethod + :keyword traffic: Traffic weights for app's revisions. + :paramtype traffic: list[~azure.mgmt.appcontainers.models.TrafficWeight] + :keyword custom_domains: custom domain bindings for Container Apps' hostnames. + :paramtype custom_domains: list[~azure.mgmt.appcontainers.models.CustomDomain] + :keyword allow_insecure: Bool indicating if HTTP connections to is allowed. If set to false + HTTP connections are automatically redirected to HTTPS connections. + :paramtype allow_insecure: bool + :keyword ip_security_restrictions: Rules to restrict incoming IP address. + :paramtype ip_security_restrictions: + list[~azure.mgmt.appcontainers.models.IpSecurityRestrictionRule] + :keyword sticky_sessions: Sticky Sessions for Single Revision Mode. + :paramtype sticky_sessions: ~azure.mgmt.appcontainers.models.IngressStickySessions + :keyword client_certificate_mode: Client certificate mode for mTLS authentication. Ignore + indicates server drops client certificate on forwarding. Accept indicates server forwards + client certificate but does not require a client certificate. Require indicates server requires + a client certificate. Known values are: "ignore", "accept", and "require". + :paramtype client_certificate_mode: str or + ~azure.mgmt.appcontainers.models.IngressClientCertificateMode + :keyword cors_policy: CORS policy for container app. + :paramtype cors_policy: ~azure.mgmt.appcontainers.models.CorsPolicy + :keyword additional_port_mappings: Settings to expose additional ports on container app. + :paramtype additional_port_mappings: list[~azure.mgmt.appcontainers.models.IngressPortMapping] + :keyword target_port_http_scheme: Whether an http app listens on http or https. Known values + are: "http" and "https". + :paramtype target_port_http_scheme: str or + ~azure.mgmt.appcontainers.models.IngressTargetPortHttpScheme """ super().__init__(**kwargs) - self.replica_completion_count = replica_completion_count - self.cron_expression = cron_expression - self.parallelism = parallelism - + self.fqdn: Optional[str] = None + self.external = external + self.target_port = target_port + self.exposed_port = exposed_port + self.transport = transport + self.traffic = traffic + self.custom_domains = custom_domains + self.allow_insecure = allow_insecure + self.ip_security_restrictions = ip_security_restrictions + self.sticky_sessions = sticky_sessions + self.client_certificate_mode = client_certificate_mode + self.cors_policy = cors_policy + self.additional_port_mappings = additional_port_mappings + self.target_port_http_scheme = target_port_http_scheme -class JobExecution(_serialization.Model): - """Container Apps Job execution. - Variables are only populated by the server, and will be ignored when sending a request. +class IngressConfiguration(_serialization.Model): + """Settings for the ingress component, including workload profile, scaling, and connection + handling. - :ivar name: Job execution Name. - :vartype name: str - :ivar id: Job execution Id. - :vartype id: str - :ivar type: Job execution type. - :vartype type: str - :ivar status: Current running State of the job. Known values are: "Running", "Processing", - "Stopped", "Degraded", "Failed", "Unknown", and "Succeeded". - :vartype status: str or ~azure.mgmt.appcontainers.models.JobExecutionRunningState - :ivar start_time: Job execution start time. - :vartype start_time: ~datetime.datetime - :ivar end_time: Job execution end time. - :vartype end_time: ~datetime.datetime - :ivar template: Job's execution container. - :vartype template: ~azure.mgmt.appcontainers.models.JobExecutionTemplate + :ivar workload_profile_name: Name of the workload profile used by the ingress component. + Required. + :vartype workload_profile_name: str + :ivar scale: Scaling configuration for the ingress component. Required. + :vartype scale: ~azure.mgmt.appcontainers.models.IngressConfigurationScale + :ivar termination_grace_period_seconds: Time (in seconds) to allow active connections to + complete on termination. Must be between 0 and 3600. Defaults to 480 seconds. + :vartype termination_grace_period_seconds: int + :ivar header_count_limit: Maximum number of headers per request allowed by the ingress. Must be + at least 1. Defaults to 100. + :vartype header_count_limit: int + :ivar request_idle_timeout: Duration (in minutes) before idle requests are timed out. Must be + at least 1 minute. Defaults to 4 minutes. + :vartype request_idle_timeout: int """ - _validation = { - "status": {"readonly": True}, - } - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "id": {"key": "id", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "status": {"key": "properties.status", "type": "str"}, - "start_time": {"key": "properties.startTime", "type": "iso-8601"}, - "end_time": {"key": "properties.endTime", "type": "iso-8601"}, - "template": {"key": "properties.template", "type": "JobExecutionTemplate"}, + "workload_profile_name": {"key": "workloadProfileName", "type": "str"}, + "scale": {"key": "scale", "type": "IngressConfigurationScale"}, + "termination_grace_period_seconds": {"key": "terminationGracePeriodSeconds", "type": "int"}, + "header_count_limit": {"key": "headerCountLimit", "type": "int"}, + "request_idle_timeout": {"key": "requestIdleTimeout", "type": "int"}, } def __init__( self, *, - name: Optional[str] = None, - id: Optional[str] = None, # pylint: disable=redefined-builtin - type: Optional[str] = None, - start_time: Optional[datetime.datetime] = None, - end_time: Optional[datetime.datetime] = None, - template: Optional["_models.JobExecutionTemplate"] = None, + workload_profile_name: Optional[str] = None, + scale: Optional["_models.IngressConfigurationScale"] = None, + termination_grace_period_seconds: Optional[int] = None, + header_count_limit: Optional[int] = None, + request_idle_timeout: Optional[int] = None, **kwargs: Any ) -> None: """ - :keyword name: Job execution Name. - :paramtype name: str - :keyword id: Job execution Id. - :paramtype id: str - :keyword type: Job execution type. - :paramtype type: str - :keyword start_time: Job execution start time. - :paramtype start_time: ~datetime.datetime - :keyword end_time: Job execution end time. - :paramtype end_time: ~datetime.datetime - :keyword template: Job's execution container. - :paramtype template: ~azure.mgmt.appcontainers.models.JobExecutionTemplate + :keyword workload_profile_name: Name of the workload profile used by the ingress component. + Required. + :paramtype workload_profile_name: str + :keyword scale: Scaling configuration for the ingress component. Required. + :paramtype scale: ~azure.mgmt.appcontainers.models.IngressConfigurationScale + :keyword termination_grace_period_seconds: Time (in seconds) to allow active connections to + complete on termination. Must be between 0 and 3600. Defaults to 480 seconds. + :paramtype termination_grace_period_seconds: int + :keyword header_count_limit: Maximum number of headers per request allowed by the ingress. Must + be at least 1. Defaults to 100. + :paramtype header_count_limit: int + :keyword request_idle_timeout: Duration (in minutes) before idle requests are timed out. Must + be at least 1 minute. Defaults to 4 minutes. + :paramtype request_idle_timeout: int """ super().__init__(**kwargs) - self.name = name - self.id = id - self.type = type - self.status = None - self.start_time = start_time - self.end_time = end_time - self.template = template + self.workload_profile_name = workload_profile_name + self.scale = scale + self.termination_grace_period_seconds = termination_grace_period_seconds + self.header_count_limit = header_count_limit + self.request_idle_timeout = request_idle_timeout -class JobExecutionBase(_serialization.Model): - """Container App's Job execution name. +class IngressConfigurationScale(_serialization.Model): + """Scaling configuration for the ingress component. Required. - :ivar name: Job execution name. - :vartype name: str - :ivar id: Job execution Id. - :vartype id: str + :ivar min_replicas: Minimum number of ingress replicas. Must be at least 2. Required. + :vartype min_replicas: int + :ivar max_replicas: Maximum number of ingress replicas. Must be greater than or equal to + minReplicas. + :vartype max_replicas: int """ _attribute_map = { - "name": {"key": "name", "type": "str"}, - "id": {"key": "id", "type": "str"}, + "min_replicas": {"key": "minReplicas", "type": "int"}, + "max_replicas": {"key": "maxReplicas", "type": "int"}, } def __init__( - self, - *, - name: Optional[str] = None, - id: Optional[str] = None, # pylint: disable=redefined-builtin - **kwargs: Any + self, *, min_replicas: Optional[int] = None, max_replicas: Optional[int] = None, **kwargs: Any ) -> None: """ - :keyword name: Job execution name. - :paramtype name: str - :keyword id: Job execution Id. - :paramtype id: str + :keyword min_replicas: Minimum number of ingress replicas. Must be at least 2. Required. + :paramtype min_replicas: int + :keyword max_replicas: Maximum number of ingress replicas. Must be greater than or equal to + minReplicas. + :paramtype max_replicas: int """ super().__init__(**kwargs) - self.name = name - self.id = id + self.min_replicas = min_replicas + self.max_replicas = max_replicas -class JobExecutionContainer(_serialization.Model): - """Container Apps Jobs execution container definition. +class IngressPortMapping(_serialization.Model): + """Port mappings of container app ingress. + + All required parameters must be populated in order to send to server. + + :ivar external: Specifies whether the app port is accessible outside of the environment. + Required. + :vartype external: bool + :ivar target_port: Specifies the port user's container listens on. Required. + :vartype target_port: int + :ivar exposed_port: Specifies the exposed port for the target port. If not specified, it + defaults to target port. + :vartype exposed_port: int + """ + + _validation = { + "external": {"required": True}, + "target_port": {"required": True}, + } + + _attribute_map = { + "external": {"key": "external", "type": "bool"}, + "target_port": {"key": "targetPort", "type": "int"}, + "exposed_port": {"key": "exposedPort", "type": "int"}, + } + + def __init__(self, *, external: bool, target_port: int, exposed_port: Optional[int] = None, **kwargs: Any) -> None: + """ + :keyword external: Specifies whether the app port is accessible outside of the environment. + Required. + :paramtype external: bool + :keyword target_port: Specifies the port user's container listens on. Required. + :paramtype target_port: int + :keyword exposed_port: Specifies the exposed port for the target port. If not specified, it + defaults to target port. + :paramtype exposed_port: int + """ + super().__init__(**kwargs) + self.external = external + self.target_port = target_port + self.exposed_port = exposed_port + + +class IngressStickySessions(_serialization.Model): + """Sticky Sessions for Single Revision Mode. + + :ivar affinity: Sticky Session Affinity. Known values are: "sticky" and "none". + :vartype affinity: str or ~azure.mgmt.appcontainers.models.Affinity + """ + + _attribute_map = { + "affinity": {"key": "affinity", "type": "str"}, + } + + def __init__(self, *, affinity: Optional[Union[str, "_models.Affinity"]] = None, **kwargs: Any) -> None: + """ + :keyword affinity: Sticky Session Affinity. Known values are: "sticky" and "none". + :paramtype affinity: str or ~azure.mgmt.appcontainers.models.Affinity + """ + super().__init__(**kwargs) + self.affinity = affinity + + +class InitContainer(BaseContainer): + """Container App init container definition. :ivar image: Container image tag. :vartype image: str + :ivar image_type: The type of the image. Set to CloudBuild to let the system manages the image, + where user will not be able to update image through image field. Set to ContainerImage for user + provided image. Known values are: "CloudBuild" and "ContainerImage". + :vartype image_type: str or ~azure.mgmt.appcontainers.models.ImageType :ivar name: Custom container name. :vartype name: str :ivar command: Container start command. @@ -5959,319 +8305,276 @@ class JobExecutionContainer(_serialization.Model): :vartype env: list[~azure.mgmt.appcontainers.models.EnvironmentVar] :ivar resources: Container resource requirements. :vartype resources: ~azure.mgmt.appcontainers.models.ContainerResources + :ivar volume_mounts: Container volume mounts. + :vartype volume_mounts: list[~azure.mgmt.appcontainers.models.VolumeMount] + """ + + +class IpSecurityRestrictionRule(_serialization.Model): + """Rule to restrict incoming IP address. + + All required parameters must be populated in order to send to server. + + :ivar name: Name for the IP restriction rule. Required. + :vartype name: str + :ivar description: Describe the IP restriction rule that is being sent to the container-app. + This is an optional field. + :vartype description: str + :ivar ip_address_range: CIDR notation to match incoming IP address. Required. + :vartype ip_address_range: str + :ivar action: Allow or Deny rules to determine for incoming IP. Note: Rules can only consist of + ALL Allow or ALL Deny. Required. Known values are: "Allow" and "Deny". + :vartype action: str or ~azure.mgmt.appcontainers.models.Action """ + _validation = { + "name": {"required": True}, + "ip_address_range": {"required": True}, + "action": {"required": True}, + } + _attribute_map = { - "image": {"key": "image", "type": "str"}, "name": {"key": "name", "type": "str"}, - "command": {"key": "command", "type": "[str]"}, - "args": {"key": "args", "type": "[str]"}, - "env": {"key": "env", "type": "[EnvironmentVar]"}, - "resources": {"key": "resources", "type": "ContainerResources"}, + "description": {"key": "description", "type": "str"}, + "ip_address_range": {"key": "ipAddressRange", "type": "str"}, + "action": {"key": "action", "type": "str"}, } def __init__( self, *, - image: Optional[str] = None, - name: Optional[str] = None, - command: Optional[List[str]] = None, - args: Optional[List[str]] = None, - env: Optional[List["_models.EnvironmentVar"]] = None, - resources: Optional["_models.ContainerResources"] = None, + name: str, + ip_address_range: str, + action: Union[str, "_models.Action"], + description: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword image: Container image tag. - :paramtype image: str - :keyword name: Custom container name. + :keyword name: Name for the IP restriction rule. Required. :paramtype name: str - :keyword command: Container start command. - :paramtype command: list[str] - :keyword args: Container start command arguments. - :paramtype args: list[str] - :keyword env: Container environment variables. - :paramtype env: list[~azure.mgmt.appcontainers.models.EnvironmentVar] - :keyword resources: Container resource requirements. - :paramtype resources: ~azure.mgmt.appcontainers.models.ContainerResources + :keyword description: Describe the IP restriction rule that is being sent to the container-app. + This is an optional field. + :paramtype description: str + :keyword ip_address_range: CIDR notation to match incoming IP address. Required. + :paramtype ip_address_range: str + :keyword action: Allow or Deny rules to determine for incoming IP. Note: Rules can only consist + of ALL Allow or ALL Deny. Required. Known values are: "Allow" and "Deny". + :paramtype action: str or ~azure.mgmt.appcontainers.models.Action """ super().__init__(**kwargs) - self.image = image self.name = name - self.command = command - self.args = args - self.env = env - self.resources = resources + self.description = description + self.ip_address_range = ip_address_range + self.action = action -class JobExecutionNamesCollection(_serialization.Model): - """Container App executions names list. +class JavaComponent(ProxyResource): + """Java Component. - All required parameters must be populated in order to send to server. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar value: Collection of resources. Required. - :vartype value: list[~azure.mgmt.appcontainers.models.JobExecutionBase] + :ivar id: Fully qualified resource ID for the resource. E.g. + "/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 properties: Java Component resource specific properties. + :vartype properties: ~azure.mgmt.appcontainers.models.JavaComponentProperties """ _validation = { - "value": {"required": True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, } _attribute_map = { - "value": {"key": "value", "type": "[JobExecutionBase]"}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "properties": {"key": "properties", "type": "JavaComponentProperties"}, } - def __init__(self, *, value: List["_models.JobExecutionBase"], **kwargs: Any) -> None: + def __init__(self, *, properties: Optional["_models.JavaComponentProperties"] = None, **kwargs: Any) -> None: """ - :keyword value: Collection of resources. Required. - :paramtype value: list[~azure.mgmt.appcontainers.models.JobExecutionBase] + :keyword properties: Java Component resource specific properties. + :paramtype properties: ~azure.mgmt.appcontainers.models.JavaComponentProperties """ super().__init__(**kwargs) - self.value = value + self.properties = properties -class JobExecutionTemplate(_serialization.Model): - """Job's execution template, containing container configuration for a job's execution. +class JavaComponentConfigurationProperty(_serialization.Model): + """Configuration properties for a Java Component. - :ivar containers: List of container definitions for the Container Apps Job. - :vartype containers: list[~azure.mgmt.appcontainers.models.JobExecutionContainer] - :ivar init_containers: List of specialized containers that run before job containers. - :vartype init_containers: list[~azure.mgmt.appcontainers.models.JobExecutionContainer] + :ivar property_name: The name of the property. + :vartype property_name: str + :ivar value: The value of the property. + :vartype value: str """ _attribute_map = { - "containers": {"key": "containers", "type": "[JobExecutionContainer]"}, - "init_containers": {"key": "initContainers", "type": "[JobExecutionContainer]"}, + "property_name": {"key": "propertyName", "type": "str"}, + "value": {"key": "value", "type": "str"}, } - def __init__( - self, - *, - containers: Optional[List["_models.JobExecutionContainer"]] = None, - init_containers: Optional[List["_models.JobExecutionContainer"]] = None, - **kwargs: Any - ) -> None: + def __init__(self, *, property_name: Optional[str] = None, value: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword containers: List of container definitions for the Container Apps Job. - :paramtype containers: list[~azure.mgmt.appcontainers.models.JobExecutionContainer] - :keyword init_containers: List of specialized containers that run before job containers. - :paramtype init_containers: list[~azure.mgmt.appcontainers.models.JobExecutionContainer] + :keyword property_name: The name of the property. + :paramtype property_name: str + :keyword value: The value of the property. + :paramtype value: str """ super().__init__(**kwargs) - self.containers = containers - self.init_containers = init_containers + self.property_name = property_name + self.value = value -class JobPatchProperties(_serialization.Model): - """Container Apps Job resource specific properties. +class JavaComponentIngress(_serialization.Model): + """Container App Ingress configuration. - :ivar identity: Managed identities needed by a container app job to interact with other Azure - services to not maintain any secrets or credentials in code. - :vartype identity: ~azure.mgmt.appcontainers.models.ManagedServiceIdentity - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar properties: - :vartype properties: ~azure.mgmt.appcontainers.models.JobPatchPropertiesProperties + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar fqdn: Hostname of the Java Component endpoint. + :vartype fqdn: str """ + _validation = { + "fqdn": {"readonly": True}, + } + _attribute_map = { - "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, - "tags": {"key": "tags", "type": "{str}"}, - "properties": {"key": "properties", "type": "JobPatchPropertiesProperties"}, + "fqdn": {"key": "fqdn", "type": "str"}, } - def __init__( - self, - *, - identity: Optional["_models.ManagedServiceIdentity"] = None, - tags: Optional[Dict[str, str]] = None, - properties: Optional["_models.JobPatchPropertiesProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword identity: Managed identities needed by a container app job to interact with other - Azure services to not maintain any secrets or credentials in code. - :paramtype identity: ~azure.mgmt.appcontainers.models.ManagedServiceIdentity - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword properties: - :paramtype properties: ~azure.mgmt.appcontainers.models.JobPatchPropertiesProperties - """ + def __init__(self, **kwargs: Any) -> None: + """ """ super().__init__(**kwargs) - self.identity = identity - self.tags = tags - self.properties = properties - - -class JobPatchPropertiesProperties(_serialization.Model): - """JobPatchPropertiesProperties. + self.fqdn: Optional[str] = None - :ivar environment_id: Resource ID of environment. - :vartype environment_id: str - :ivar configuration: Container Apps Job configuration properties. - :vartype configuration: ~azure.mgmt.appcontainers.models.JobConfiguration - :ivar template: Container Apps job definition. - :vartype template: ~azure.mgmt.appcontainers.models.JobTemplate - :ivar outbound_ip_addresses: Outbound IP Addresses of a container apps job. - :vartype outbound_ip_addresses: list[str] - :ivar event_stream_endpoint: The endpoint of the eventstream of the container apps job. - :vartype event_stream_endpoint: str - """ - _attribute_map = { - "environment_id": {"key": "environmentId", "type": "str"}, - "configuration": {"key": "configuration", "type": "JobConfiguration"}, - "template": {"key": "template", "type": "JobTemplate"}, - "outbound_ip_addresses": {"key": "outboundIpAddresses", "type": "[str]"}, - "event_stream_endpoint": {"key": "eventStreamEndpoint", "type": "str"}, - } +class JavaComponentProperties(_serialization.Model): + """Java Component common properties. - def __init__( - self, - *, - environment_id: Optional[str] = None, - configuration: Optional["_models.JobConfiguration"] = None, - template: Optional["_models.JobTemplate"] = None, - outbound_ip_addresses: Optional[List[str]] = None, - event_stream_endpoint: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword environment_id: Resource ID of environment. - :paramtype environment_id: str - :keyword configuration: Container Apps Job configuration properties. - :paramtype configuration: ~azure.mgmt.appcontainers.models.JobConfiguration - :keyword template: Container Apps job definition. - :paramtype template: ~azure.mgmt.appcontainers.models.JobTemplate - :keyword outbound_ip_addresses: Outbound IP Addresses of a container apps job. - :paramtype outbound_ip_addresses: list[str] - :keyword event_stream_endpoint: The endpoint of the eventstream of the container apps job. - :paramtype event_stream_endpoint: str - """ - super().__init__(**kwargs) - self.environment_id = environment_id - self.configuration = configuration - self.template = template - self.outbound_ip_addresses = outbound_ip_addresses - self.event_stream_endpoint = event_stream_endpoint + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + NacosComponent, SpringBootAdminComponent, SpringCloudConfigComponent, + SpringCloudEurekaComponent, SpringCloudGatewayComponent + Variables are only populated by the server, and will be ignored when sending a request. -class JobScale(_serialization.Model): - """Scaling configurations for event driven jobs. + All required parameters must be populated in order to send to server. - :ivar polling_interval: Interval to check each event source in seconds. Defaults to 30s. - :vartype polling_interval: int - :ivar min_executions: Minimum number of job executions that are created for a trigger, default - 0. - :vartype min_executions: int - :ivar max_executions: Maximum number of job executions that are created for a trigger, default - 100. - :vartype max_executions: int - :ivar rules: Scaling rules. - :vartype rules: list[~azure.mgmt.appcontainers.models.JobScaleRule] + :ivar component_type: Type of the Java Component. Required. Known values are: + "SpringBootAdmin", "SpringCloudEureka", "SpringCloudConfig", "SpringCloudGateway", and "Nacos". + :vartype component_type: str or ~azure.mgmt.appcontainers.models.JavaComponentType + :ivar provisioning_state: Provisioning state of the Java Component. Known values are: + "Succeeded", "Failed", "Canceled", "Deleting", and "InProgress". + :vartype provisioning_state: str or + ~azure.mgmt.appcontainers.models.JavaComponentProvisioningState + :ivar configurations: List of Java Components configuration properties. + :vartype configurations: + list[~azure.mgmt.appcontainers.models.JavaComponentConfigurationProperty] + :ivar scale: Java component scaling configurations. + :vartype scale: ~azure.mgmt.appcontainers.models.JavaComponentPropertiesScale + :ivar service_binds: List of Java Components that are bound to the Java component. + :vartype service_binds: list[~azure.mgmt.appcontainers.models.JavaComponentServiceBind] """ + _validation = { + "component_type": {"required": True}, + "provisioning_state": {"readonly": True}, + } + _attribute_map = { - "polling_interval": {"key": "pollingInterval", "type": "int"}, - "min_executions": {"key": "minExecutions", "type": "int"}, - "max_executions": {"key": "maxExecutions", "type": "int"}, - "rules": {"key": "rules", "type": "[JobScaleRule]"}, + "component_type": {"key": "componentType", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "configurations": {"key": "configurations", "type": "[JavaComponentConfigurationProperty]"}, + "scale": {"key": "scale", "type": "JavaComponentPropertiesScale"}, + "service_binds": {"key": "serviceBinds", "type": "[JavaComponentServiceBind]"}, + } + + _subtype_map = { + "component_type": { + "Nacos": "NacosComponent", + "SpringBootAdmin": "SpringBootAdminComponent", + "SpringCloudConfig": "SpringCloudConfigComponent", + "SpringCloudEureka": "SpringCloudEurekaComponent", + "SpringCloudGateway": "SpringCloudGatewayComponent", + } } def __init__( self, *, - polling_interval: Optional[int] = None, - min_executions: int = 0, - max_executions: int = 100, - rules: Optional[List["_models.JobScaleRule"]] = None, + configurations: Optional[List["_models.JavaComponentConfigurationProperty"]] = None, + scale: Optional["_models.JavaComponentPropertiesScale"] = None, + service_binds: Optional[List["_models.JavaComponentServiceBind"]] = None, **kwargs: Any ) -> None: """ - :keyword polling_interval: Interval to check each event source in seconds. Defaults to 30s. - :paramtype polling_interval: int - :keyword min_executions: Minimum number of job executions that are created for a trigger, - default 0. - :paramtype min_executions: int - :keyword max_executions: Maximum number of job executions that are created for a trigger, - default 100. - :paramtype max_executions: int - :keyword rules: Scaling rules. - :paramtype rules: list[~azure.mgmt.appcontainers.models.JobScaleRule] + :keyword configurations: List of Java Components configuration properties. + :paramtype configurations: + list[~azure.mgmt.appcontainers.models.JavaComponentConfigurationProperty] + :keyword scale: Java component scaling configurations. + :paramtype scale: ~azure.mgmt.appcontainers.models.JavaComponentPropertiesScale + :keyword service_binds: List of Java Components that are bound to the Java component. + :paramtype service_binds: list[~azure.mgmt.appcontainers.models.JavaComponentServiceBind] """ super().__init__(**kwargs) - self.polling_interval = polling_interval - self.min_executions = min_executions - self.max_executions = max_executions - self.rules = rules + self.component_type: Optional[str] = None + self.provisioning_state: Optional[Union[str, "_models.JavaComponentProvisioningState"]] = None + self.configurations = configurations + self.scale = scale + self.service_binds = service_binds -class JobScaleRule(_serialization.Model): - """Scaling rule. +class JavaComponentPropertiesScale(_serialization.Model): + """Java component scaling configurations. - :ivar name: Scale Rule Name. - :vartype name: str - :ivar type: Type of the scale rule - eg: azure-servicebus, redis etc. - :vartype type: str - :ivar metadata: Metadata properties to describe the scale rule. - :vartype metadata: JSON - :ivar auth: Authentication secrets for the scale rule. - :vartype auth: list[~azure.mgmt.appcontainers.models.ScaleRuleAuth] - :ivar identity: The resource ID of a user-assigned managed identity that is assigned to the - Container App, or 'system' for system-assigned identity. - :vartype identity: str + :ivar min_replicas: Optional. Minimum number of Java component replicas. Defaults to 1 if not + set. + :vartype min_replicas: int + :ivar max_replicas: Optional. Maximum number of Java component replicas. + :vartype max_replicas: int """ _attribute_map = { - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "metadata": {"key": "metadata", "type": "object"}, - "auth": {"key": "auth", "type": "[ScaleRuleAuth]"}, - "identity": {"key": "identity", "type": "str"}, + "min_replicas": {"key": "minReplicas", "type": "int"}, + "max_replicas": {"key": "maxReplicas", "type": "int"}, } def __init__( - self, - *, - name: Optional[str] = None, - type: Optional[str] = None, - metadata: Optional[JSON] = None, - auth: Optional[List["_models.ScaleRuleAuth"]] = None, - identity: Optional[str] = None, - **kwargs: Any + self, *, min_replicas: Optional[int] = None, max_replicas: Optional[int] = None, **kwargs: Any ) -> None: """ - :keyword name: Scale Rule Name. - :paramtype name: str - :keyword type: Type of the scale rule - eg: azure-servicebus, redis etc. - :paramtype type: str - :keyword metadata: Metadata properties to describe the scale rule. - :paramtype metadata: JSON - :keyword auth: Authentication secrets for the scale rule. - :paramtype auth: list[~azure.mgmt.appcontainers.models.ScaleRuleAuth] - :keyword identity: The resource ID of a user-assigned managed identity that is assigned to the - Container App, or 'system' for system-assigned identity. - :paramtype identity: str + :keyword min_replicas: Optional. Minimum number of Java component replicas. Defaults to 1 if + not set. + :paramtype min_replicas: int + :keyword max_replicas: Optional. Maximum number of Java component replicas. + :paramtype max_replicas: int """ super().__init__(**kwargs) - self.name = name - self.type = type - self.metadata = metadata - self.auth = auth - self.identity = identity + self.min_replicas = min_replicas + self.max_replicas = max_replicas -class JobsCollection(_serialization.Model): - """Container Apps Jobs collection ARM resource. +class JavaComponentsCollection(_serialization.Model): + """Java Components ARM resource. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to server. :ivar value: Collection of resources. Required. - :vartype value: list[~azure.mgmt.appcontainers.models.Job] + :vartype value: list[~azure.mgmt.appcontainers.models.JavaComponent] :ivar next_link: Link to next page of resources. :vartype next_link: str """ @@ -6282,1394 +8585,3377 @@ class JobsCollection(_serialization.Model): } _attribute_map = { - "value": {"key": "value", "type": "[Job]"}, + "value": {"key": "value", "type": "[JavaComponent]"}, "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: List["_models.Job"], **kwargs: Any) -> None: + def __init__(self, *, value: List["_models.JavaComponent"], **kwargs: Any) -> None: """ :keyword value: Collection of resources. Required. - :paramtype value: list[~azure.mgmt.appcontainers.models.Job] + :paramtype value: list[~azure.mgmt.appcontainers.models.JavaComponent] """ super().__init__(**kwargs) self.value = value - self.next_link = None - + self.next_link: Optional[str] = None -class JobSecretsCollection(_serialization.Model): - """Container Apps Job Secrets Collection ARM resource. - All required parameters must be populated in order to send to server. +class JavaComponentServiceBind(_serialization.Model): + """Configuration to bind a Java Component to another Java Component. - :ivar value: Collection of resources. Required. - :vartype value: list[~azure.mgmt.appcontainers.models.Secret] + :ivar name: Name of the service bind. + :vartype name: str + :ivar service_id: Resource id of the target service. + :vartype service_id: str """ - _validation = { - "value": {"required": True}, - } - _attribute_map = { - "value": {"key": "value", "type": "[Secret]"}, + "name": {"key": "name", "type": "str"}, + "service_id": {"key": "serviceId", "type": "str"}, } - def __init__(self, *, value: List["_models.Secret"], **kwargs: Any) -> None: + def __init__(self, *, name: Optional[str] = None, service_id: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword value: Collection of resources. Required. - :paramtype value: list[~azure.mgmt.appcontainers.models.Secret] + :keyword name: Name of the service bind. + :paramtype name: str + :keyword service_id: Resource id of the target service. + :paramtype service_id: str """ super().__init__(**kwargs) - self.value = value + self.name = name + self.service_id = service_id -class JobTemplate(_serialization.Model): - """Container Apps Job versioned application definition. Defines the desired state of an immutable - revision. Any changes to this section Will result in a new revision being created. +class Job(TrackedResource): + """Container App Job. - :ivar init_containers: List of specialized containers that run before app containers. - :vartype init_containers: list[~azure.mgmt.appcontainers.models.InitContainer] - :ivar containers: List of container definitions for the Container App. - :vartype containers: list[~azure.mgmt.appcontainers.models.Container] - :ivar volumes: List of volume definitions for the Container App. - :vartype volumes: list[~azure.mgmt.appcontainers.models.Volume] - """ + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar extended_location: The complex type of the extended location. + :vartype extended_location: ~azure.mgmt.appcontainers.models.ExtendedLocation + :ivar identity: Managed identities needed by a container app job to interact with other Azure + services to not maintain any secrets or credentials in code. + :vartype identity: ~azure.mgmt.appcontainers.models.ManagedServiceIdentity + :ivar provisioning_state: Provisioning state of the Container Apps Job. Known values are: + "InProgress", "Succeeded", "Failed", "Canceled", and "Deleting". + :vartype provisioning_state: str or ~azure.mgmt.appcontainers.models.JobProvisioningState + :ivar running_state: Current running state of the job. Known values are: "Ready", + "Progressing", and "Suspended". + :vartype running_state: str or ~azure.mgmt.appcontainers.models.JobRunningState + :ivar environment_id: Resource ID of environment. + :vartype environment_id: str + :ivar workload_profile_name: Workload profile name to pin for container apps job execution. + :vartype workload_profile_name: str + :ivar configuration: Container Apps Job configuration properties. + :vartype configuration: ~azure.mgmt.appcontainers.models.JobConfiguration + :ivar template: Container Apps job definition. + :vartype template: ~azure.mgmt.appcontainers.models.JobTemplate + :ivar outbound_ip_addresses: Outbound IP Addresses of a container apps job. + :vartype outbound_ip_addresses: list[str] + :ivar event_stream_endpoint: The endpoint of the eventstream of the container apps job. + :vartype event_stream_endpoint: str + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, + "provisioning_state": {"readonly": True}, + "running_state": {"readonly": True}, + "outbound_ip_addresses": {"readonly": True}, + "event_stream_endpoint": {"readonly": True}, + } _attribute_map = { - "init_containers": {"key": "initContainers", "type": "[InitContainer]"}, - "containers": {"key": "containers", "type": "[Container]"}, - "volumes": {"key": "volumes", "type": "[Volume]"}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, + "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "running_state": {"key": "properties.runningState", "type": "str"}, + "environment_id": {"key": "properties.environmentId", "type": "str"}, + "workload_profile_name": {"key": "properties.workloadProfileName", "type": "str"}, + "configuration": {"key": "properties.configuration", "type": "JobConfiguration"}, + "template": {"key": "properties.template", "type": "JobTemplate"}, + "outbound_ip_addresses": {"key": "properties.outboundIpAddresses", "type": "[str]"}, + "event_stream_endpoint": {"key": "properties.eventStreamEndpoint", "type": "str"}, } def __init__( self, *, - init_containers: Optional[List["_models.InitContainer"]] = None, - containers: Optional[List["_models.Container"]] = None, - volumes: Optional[List["_models.Volume"]] = None, + location: str, + tags: Optional[Dict[str, str]] = None, + extended_location: Optional["_models.ExtendedLocation"] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, + environment_id: Optional[str] = None, + workload_profile_name: Optional[str] = None, + configuration: Optional["_models.JobConfiguration"] = None, + template: Optional["_models.JobTemplate"] = None, **kwargs: Any ) -> None: """ - :keyword init_containers: List of specialized containers that run before app containers. - :paramtype init_containers: list[~azure.mgmt.appcontainers.models.InitContainer] - :keyword containers: List of container definitions for the Container App. - :paramtype containers: list[~azure.mgmt.appcontainers.models.Container] - :keyword volumes: List of volume definitions for the Container App. - :paramtype volumes: list[~azure.mgmt.appcontainers.models.Volume] + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str + :keyword extended_location: The complex type of the extended location. + :paramtype extended_location: ~azure.mgmt.appcontainers.models.ExtendedLocation + :keyword identity: Managed identities needed by a container app job to interact with other + Azure services to not maintain any secrets or credentials in code. + :paramtype identity: ~azure.mgmt.appcontainers.models.ManagedServiceIdentity + :keyword environment_id: Resource ID of environment. + :paramtype environment_id: str + :keyword workload_profile_name: Workload profile name to pin for container apps job execution. + :paramtype workload_profile_name: str + :keyword configuration: Container Apps Job configuration properties. + :paramtype configuration: ~azure.mgmt.appcontainers.models.JobConfiguration + :keyword template: Container Apps job definition. + :paramtype template: ~azure.mgmt.appcontainers.models.JobTemplate """ - super().__init__(**kwargs) - self.init_containers = init_containers - self.containers = containers - self.volumes = volumes + super().__init__(tags=tags, location=location, **kwargs) + self.extended_location = extended_location + self.identity = identity + self.provisioning_state: Optional[Union[str, "_models.JobProvisioningState"]] = None + self.running_state: Optional[Union[str, "_models.JobRunningState"]] = None + self.environment_id = environment_id + self.workload_profile_name = workload_profile_name + self.configuration = configuration + self.template = template + self.outbound_ip_addresses: Optional[List[str]] = None + self.event_stream_endpoint: Optional[str] = None -class JwtClaimChecks(_serialization.Model): - """The configuration settings of the checks that should be made while validating the JWT Claims. +class JobConfiguration(_serialization.Model): + """Non versioned Container Apps Job configuration properties. - :ivar allowed_groups: The list of the allowed groups. - :vartype allowed_groups: list[str] - :ivar allowed_client_applications: The list of the allowed client applications. - :vartype allowed_client_applications: list[str] + All required parameters must be populated in order to send to server. + + :ivar secrets: Collection of secrets used by a Container Apps Job. + :vartype secrets: list[~azure.mgmt.appcontainers.models.Secret] + :ivar trigger_type: Trigger type of the job. Known values are: "Schedule", "Event", and + "Manual". + :vartype trigger_type: str or ~azure.mgmt.appcontainers.models.TriggerType + :ivar replica_timeout: Maximum number of seconds a replica is allowed to run. Required. + :vartype replica_timeout: int + :ivar replica_retry_limit: Maximum number of retries before failing the job. + :vartype replica_retry_limit: int + :ivar manual_trigger_config: Manual trigger configuration for a single execution job. + Properties replicaCompletionCount and parallelism would be set to 1 by default. + :vartype manual_trigger_config: + ~azure.mgmt.appcontainers.models.JobConfigurationManualTriggerConfig + :ivar schedule_trigger_config: Cron formatted repeating trigger schedule ("\\ * * * * *") for + cronjobs. Properties completions and parallelism would be set to 1 by default. + :vartype schedule_trigger_config: + ~azure.mgmt.appcontainers.models.JobConfigurationScheduleTriggerConfig + :ivar event_trigger_config: Trigger configuration of an event driven job. + :vartype event_trigger_config: + ~azure.mgmt.appcontainers.models.JobConfigurationEventTriggerConfig + :ivar registries: Collection of private container registry credentials used by a Container apps + job. + :vartype registries: list[~azure.mgmt.appcontainers.models.RegistryCredentials] + :ivar identity_settings: Optional settings for Managed Identities that are assigned to the + Container App Job. If a Managed Identity is not specified here, default settings will be used. + :vartype identity_settings: list[~azure.mgmt.appcontainers.models.IdentitySettings] """ + _validation = { + "trigger_type": {"required": True}, + "replica_timeout": {"required": True}, + } + _attribute_map = { - "allowed_groups": {"key": "allowedGroups", "type": "[str]"}, - "allowed_client_applications": {"key": "allowedClientApplications", "type": "[str]"}, + "secrets": {"key": "secrets", "type": "[Secret]"}, + "trigger_type": {"key": "triggerType", "type": "str"}, + "replica_timeout": {"key": "replicaTimeout", "type": "int"}, + "replica_retry_limit": {"key": "replicaRetryLimit", "type": "int"}, + "manual_trigger_config": {"key": "manualTriggerConfig", "type": "JobConfigurationManualTriggerConfig"}, + "schedule_trigger_config": {"key": "scheduleTriggerConfig", "type": "JobConfigurationScheduleTriggerConfig"}, + "event_trigger_config": {"key": "eventTriggerConfig", "type": "JobConfigurationEventTriggerConfig"}, + "registries": {"key": "registries", "type": "[RegistryCredentials]"}, + "identity_settings": {"key": "identitySettings", "type": "[IdentitySettings]"}, } def __init__( self, *, - allowed_groups: Optional[List[str]] = None, - allowed_client_applications: Optional[List[str]] = None, + trigger_type: Union[str, "_models.TriggerType"] = "Manual", + replica_timeout: int, + secrets: Optional[List["_models.Secret"]] = None, + replica_retry_limit: Optional[int] = None, + manual_trigger_config: Optional["_models.JobConfigurationManualTriggerConfig"] = None, + schedule_trigger_config: Optional["_models.JobConfigurationScheduleTriggerConfig"] = None, + event_trigger_config: Optional["_models.JobConfigurationEventTriggerConfig"] = None, + registries: Optional[List["_models.RegistryCredentials"]] = None, + identity_settings: Optional[List["_models.IdentitySettings"]] = None, **kwargs: Any ) -> None: """ - :keyword allowed_groups: The list of the allowed groups. - :paramtype allowed_groups: list[str] - :keyword allowed_client_applications: The list of the allowed client applications. - :paramtype allowed_client_applications: list[str] + :keyword secrets: Collection of secrets used by a Container Apps Job. + :paramtype secrets: list[~azure.mgmt.appcontainers.models.Secret] + :keyword trigger_type: Trigger type of the job. Known values are: "Schedule", "Event", and + "Manual". + :paramtype trigger_type: str or ~azure.mgmt.appcontainers.models.TriggerType + :keyword replica_timeout: Maximum number of seconds a replica is allowed to run. Required. + :paramtype replica_timeout: int + :keyword replica_retry_limit: Maximum number of retries before failing the job. + :paramtype replica_retry_limit: int + :keyword manual_trigger_config: Manual trigger configuration for a single execution job. + Properties replicaCompletionCount and parallelism would be set to 1 by default. + :paramtype manual_trigger_config: + ~azure.mgmt.appcontainers.models.JobConfigurationManualTriggerConfig + :keyword schedule_trigger_config: Cron formatted repeating trigger schedule ("\\ * * * * *") + for cronjobs. Properties completions and parallelism would be set to 1 by default. + :paramtype schedule_trigger_config: + ~azure.mgmt.appcontainers.models.JobConfigurationScheduleTriggerConfig + :keyword event_trigger_config: Trigger configuration of an event driven job. + :paramtype event_trigger_config: + ~azure.mgmt.appcontainers.models.JobConfigurationEventTriggerConfig + :keyword registries: Collection of private container registry credentials used by a Container + apps job. + :paramtype registries: list[~azure.mgmt.appcontainers.models.RegistryCredentials] + :keyword identity_settings: Optional settings for Managed Identities that are assigned to the + Container App Job. If a Managed Identity is not specified here, default settings will be used. + :paramtype identity_settings: list[~azure.mgmt.appcontainers.models.IdentitySettings] """ super().__init__(**kwargs) - self.allowed_groups = allowed_groups - self.allowed_client_applications = allowed_client_applications - + self.secrets = secrets + self.trigger_type = trigger_type + self.replica_timeout = replica_timeout + self.replica_retry_limit = replica_retry_limit + self.manual_trigger_config = manual_trigger_config + self.schedule_trigger_config = schedule_trigger_config + self.event_trigger_config = event_trigger_config + self.registries = registries + self.identity_settings = identity_settings -class KedaConfiguration(_serialization.Model): - """Configuration properties Keda component. - Variables are only populated by the server, and will be ignored when sending a request. +class JobConfigurationEventTriggerConfig(_serialization.Model): + """Trigger configuration of an event driven job. - :ivar version: The version of Keda. - :vartype version: str + :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 """ - _validation = { - "version": {"readonly": True}, - } - _attribute_map = { - "version": {"key": "version", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.version = None - - -class LifecycleConfiguration(_serialization.Model): - """The lifecycle configuration properties of a session in the dynamic session pool. - - :ivar lifecycle_type: The lifecycle type of the session pool. Known values are: "Timed" and - "OnContainerExit". - :vartype lifecycle_type: str or ~azure.mgmt.appcontainers.models.LifecycleType - :ivar cooldown_period_in_seconds: The cooldown period of a session in seconds when the - lifecycle type is 'Timed'. - :vartype cooldown_period_in_seconds: int - :ivar max_alive_period_in_seconds: The maximum alive period of a session in seconds when the - lifecycle type is 'OnContainerExit'. - :vartype max_alive_period_in_seconds: int - """ - - _attribute_map = { - "lifecycle_type": {"key": "lifecycleType", "type": "str"}, - "cooldown_period_in_seconds": {"key": "cooldownPeriodInSeconds", "type": "int"}, - "max_alive_period_in_seconds": {"key": "maxAlivePeriodInSeconds", "type": "int"}, + "replica_completion_count": {"key": "replicaCompletionCount", "type": "int"}, + "parallelism": {"key": "parallelism", "type": "int"}, + "scale": {"key": "scale", "type": "JobScale"}, } def __init__( self, *, - lifecycle_type: Optional[Union[str, "_models.LifecycleType"]] = None, - cooldown_period_in_seconds: Optional[int] = None, - max_alive_period_in_seconds: Optional[int] = None, + replica_completion_count: Optional[int] = None, + parallelism: Optional[int] = None, + scale: Optional["_models.JobScale"] = None, **kwargs: Any ) -> None: """ - :keyword lifecycle_type: The lifecycle type of the session pool. Known values are: "Timed" and - "OnContainerExit". - :paramtype lifecycle_type: str or ~azure.mgmt.appcontainers.models.LifecycleType - :keyword cooldown_period_in_seconds: The cooldown period of a session in seconds when the - lifecycle type is 'Timed'. - :paramtype cooldown_period_in_seconds: int - :keyword max_alive_period_in_seconds: The maximum alive period of a session in seconds when the - lifecycle type is 'OnContainerExit'. - :paramtype max_alive_period_in_seconds: int + :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.lifecycle_type = lifecycle_type - self.cooldown_period_in_seconds = cooldown_period_in_seconds - self.max_alive_period_in_seconds = max_alive_period_in_seconds + self.replica_completion_count = replica_completion_count + self.parallelism = parallelism + self.scale = scale -class ListUsagesResult(_serialization.Model): - """ListUsagesResult. +class JobConfigurationManualTriggerConfig(_serialization.Model): + """Manual trigger configuration for a single execution job. Properties replicaCompletionCount and + parallelism would be set to 1 by default. - :ivar value: The list of compute resource usages. - :vartype value: list[~azure.mgmt.appcontainers.models.Usage] - :ivar next_link: The URI to fetch the next page of compute resource usage information. Call - ListNext() with this to fetch the next page of compute resource usage information. - :vartype next_link: str + :ivar replica_completion_count: Minimum number of successful replica completions before overall + job completion. + :vartype replica_completion_count: int + :ivar parallelism: Number of parallel replicas of a job that can run at a given time. + :vartype parallelism: int """ _attribute_map = { - "value": {"key": "value", "type": "[Usage]"}, - "next_link": {"key": "nextLink", "type": "str"}, + "replica_completion_count": {"key": "replicaCompletionCount", "type": "int"}, + "parallelism": {"key": "parallelism", "type": "int"}, } def __init__( - self, *, value: Optional[List["_models.Usage"]] = None, next_link: Optional[str] = None, **kwargs: Any + self, *, replica_completion_count: Optional[int] = None, parallelism: Optional[int] = None, **kwargs: Any ) -> None: """ - :keyword value: The list of compute resource usages. - :paramtype value: list[~azure.mgmt.appcontainers.models.Usage] - :keyword next_link: The URI to fetch the next page of compute resource usage information. Call - ListNext() with this to fetch the next page of compute resource usage information. - :paramtype next_link: str + :keyword replica_completion_count: Minimum number of successful replica completions before + overall job completion. + :paramtype replica_completion_count: int + :keyword parallelism: Number of parallel replicas of a job that can run at a given time. + :paramtype parallelism: int """ super().__init__(**kwargs) - self.value = value - self.next_link = next_link + self.replica_completion_count = replica_completion_count + self.parallelism = parallelism -class LogAnalyticsConfiguration(_serialization.Model): - """Log Analytics configuration, must only be provided when destination is configured as - 'log-analytics'. +class JobConfigurationScheduleTriggerConfig(_serialization.Model): + """Cron formatted repeating trigger schedule ("\\ * * * * *") for cronjobs. Properties completions + and parallelism would be set to 1 by default. - :ivar customer_id: Log analytics customer id. - :vartype customer_id: str - :ivar shared_key: Log analytics customer key. - :vartype shared_key: str + All required parameters must be populated in order to send to server. + + :ivar replica_completion_count: Minimum number of successful replica completions before overall + job completion. + :vartype replica_completion_count: int + :ivar cron_expression: Cron formatted repeating schedule ("\\ * * * * *") of a Cron Job. + Required. + :vartype cron_expression: str + :ivar parallelism: Number of parallel replicas of a job that can run at a given time. + :vartype parallelism: int """ + _validation = { + "cron_expression": {"required": True}, + } + _attribute_map = { - "customer_id": {"key": "customerId", "type": "str"}, - "shared_key": {"key": "sharedKey", "type": "str"}, + "replica_completion_count": {"key": "replicaCompletionCount", "type": "int"}, + "cron_expression": {"key": "cronExpression", "type": "str"}, + "parallelism": {"key": "parallelism", "type": "int"}, } - def __init__(self, *, customer_id: Optional[str] = None, shared_key: Optional[str] = None, **kwargs: Any) -> None: + def __init__( + self, + *, + cron_expression: str, + replica_completion_count: Optional[int] = None, + parallelism: Optional[int] = None, + **kwargs: Any + ) -> None: """ - :keyword customer_id: Log analytics customer id. - :paramtype customer_id: str - :keyword shared_key: Log analytics customer key. - :paramtype shared_key: str + :keyword replica_completion_count: Minimum number of successful replica completions before + overall job completion. + :paramtype replica_completion_count: int + :keyword cron_expression: Cron formatted repeating schedule ("\\ * * * * *") of a Cron Job. + Required. + :paramtype cron_expression: str + :keyword parallelism: Number of parallel replicas of a job that can run at a given time. + :paramtype parallelism: int """ super().__init__(**kwargs) - self.customer_id = customer_id - self.shared_key = shared_key + self.replica_completion_count = replica_completion_count + self.cron_expression = cron_expression + self.parallelism = parallelism -class Login(_serialization.Model): - """The configuration settings of the login flow of users using ContainerApp Service - Authentication/Authorization. +class JobExecution(_serialization.Model): + """Container Apps Job execution. - :ivar routes: The routes that specify the endpoints used for login and logout requests. - :vartype routes: ~azure.mgmt.appcontainers.models.LoginRoutes - :ivar token_store: The configuration settings of the token store. - :vartype token_store: ~azure.mgmt.appcontainers.models.TokenStore - :ivar preserve_url_fragments_for_logins: :code:`true` if the fragments from the - request are preserved after the login request is made; otherwise, :code:`false`. - :vartype preserve_url_fragments_for_logins: bool - :ivar allowed_external_redirect_urls: External URLs that can be redirected to as part of - logging in or logging out of the app. Note that the query string part of the URL is ignored. - This is an advanced setting typically only needed by Windows Store application backends. - Note that URLs within the current domain are always implicitly allowed. - :vartype allowed_external_redirect_urls: list[str] - :ivar cookie_expiration: The configuration settings of the session cookie's expiration. - :vartype cookie_expiration: ~azure.mgmt.appcontainers.models.CookieExpiration - :ivar nonce: The configuration settings of the nonce used in the login flow. - :vartype nonce: ~azure.mgmt.appcontainers.models.Nonce + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Job execution Name. + :vartype name: str + :ivar id: Job execution Id. + :vartype id: str + :ivar type: Job execution type. + :vartype type: str + :ivar status: Current running State of the job. Known values are: "Running", "Processing", + "Stopped", "Degraded", "Failed", "Unknown", and "Succeeded". + :vartype status: str or ~azure.mgmt.appcontainers.models.JobExecutionRunningState + :ivar start_time: Job execution start time. + :vartype start_time: ~datetime.datetime + :ivar end_time: Job execution end time. + :vartype end_time: ~datetime.datetime + :ivar template: Job's execution container. + :vartype template: ~azure.mgmt.appcontainers.models.JobExecutionTemplate + :ivar detailed_status: Detailed status of the job execution. + :vartype detailed_status: ~azure.mgmt.appcontainers.models.ExecutionStatus """ + _validation = { + "status": {"readonly": True}, + } + _attribute_map = { - "routes": {"key": "routes", "type": "LoginRoutes"}, - "token_store": {"key": "tokenStore", "type": "TokenStore"}, - "preserve_url_fragments_for_logins": {"key": "preserveUrlFragmentsForLogins", "type": "bool"}, - "allowed_external_redirect_urls": {"key": "allowedExternalRedirectUrls", "type": "[str]"}, - "cookie_expiration": {"key": "cookieExpiration", "type": "CookieExpiration"}, - "nonce": {"key": "nonce", "type": "Nonce"}, + "name": {"key": "name", "type": "str"}, + "id": {"key": "id", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "status": {"key": "properties.status", "type": "str"}, + "start_time": {"key": "properties.startTime", "type": "iso-8601"}, + "end_time": {"key": "properties.endTime", "type": "iso-8601"}, + "template": {"key": "properties.template", "type": "JobExecutionTemplate"}, + "detailed_status": {"key": "properties.detailedStatus", "type": "ExecutionStatus"}, } def __init__( self, *, - routes: Optional["_models.LoginRoutes"] = None, - token_store: Optional["_models.TokenStore"] = None, - preserve_url_fragments_for_logins: Optional[bool] = None, - allowed_external_redirect_urls: Optional[List[str]] = None, - cookie_expiration: Optional["_models.CookieExpiration"] = None, - nonce: Optional["_models.Nonce"] = None, + name: Optional[str] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin + type: Optional[str] = None, + start_time: Optional[datetime.datetime] = None, + end_time: Optional[datetime.datetime] = None, + template: Optional["_models.JobExecutionTemplate"] = None, + detailed_status: Optional["_models.ExecutionStatus"] = None, **kwargs: Any ) -> None: """ - :keyword routes: The routes that specify the endpoints used for login and logout requests. - :paramtype routes: ~azure.mgmt.appcontainers.models.LoginRoutes - :keyword token_store: The configuration settings of the token store. - :paramtype token_store: ~azure.mgmt.appcontainers.models.TokenStore - :keyword preserve_url_fragments_for_logins: :code:`true` if the fragments from the - request are preserved after the login request is made; otherwise, :code:`false`. - :paramtype preserve_url_fragments_for_logins: bool - :keyword allowed_external_redirect_urls: External URLs that can be redirected to as part of - logging in or logging out of the app. Note that the query string part of the URL is ignored. - This is an advanced setting typically only needed by Windows Store application backends. - Note that URLs within the current domain are always implicitly allowed. - :paramtype allowed_external_redirect_urls: list[str] - :keyword cookie_expiration: The configuration settings of the session cookie's expiration. - :paramtype cookie_expiration: ~azure.mgmt.appcontainers.models.CookieExpiration - :keyword nonce: The configuration settings of the nonce used in the login flow. - :paramtype nonce: ~azure.mgmt.appcontainers.models.Nonce + :keyword name: Job execution Name. + :paramtype name: str + :keyword id: Job execution Id. + :paramtype id: str + :keyword type: Job execution type. + :paramtype type: str + :keyword start_time: Job execution start time. + :paramtype start_time: ~datetime.datetime + :keyword end_time: Job execution end time. + :paramtype end_time: ~datetime.datetime + :keyword template: Job's execution container. + :paramtype template: ~azure.mgmt.appcontainers.models.JobExecutionTemplate + :keyword detailed_status: Detailed status of the job execution. + :paramtype detailed_status: ~azure.mgmt.appcontainers.models.ExecutionStatus """ super().__init__(**kwargs) - self.routes = routes - self.token_store = token_store - self.preserve_url_fragments_for_logins = preserve_url_fragments_for_logins - self.allowed_external_redirect_urls = allowed_external_redirect_urls - self.cookie_expiration = cookie_expiration - self.nonce = nonce + self.name = name + self.id = id + self.type = type + self.status: Optional[Union[str, "_models.JobExecutionRunningState"]] = None + self.start_time = start_time + self.end_time = end_time + self.template = template + self.detailed_status = detailed_status -class LoginRoutes(_serialization.Model): - """The routes that specify the endpoints used for login and logout requests. +class JobExecutionBase(_serialization.Model): + """Container App's Job execution name. - :ivar logout_endpoint: The endpoint at which a logout request should be made. - :vartype logout_endpoint: str + :ivar name: Job execution name. + :vartype name: str + :ivar id: Job execution Id. + :vartype id: str """ _attribute_map = { - "logout_endpoint": {"key": "logoutEndpoint", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "id": {"key": "id", "type": "str"}, } - def __init__(self, *, logout_endpoint: Optional[str] = None, **kwargs: Any) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin + **kwargs: Any + ) -> None: """ - :keyword logout_endpoint: The endpoint at which a logout request should be made. - :paramtype logout_endpoint: str - """ - super().__init__(**kwargs) - self.logout_endpoint = logout_endpoint - - -class LoginScopes(_serialization.Model): - """The configuration settings of the login flow, including the scopes that should be requested. - - :ivar scopes: A list of the scopes that should be requested while authenticating. - :vartype scopes: list[str] - """ - - _attribute_map = { - "scopes": {"key": "scopes", "type": "[str]"}, - } - - def __init__(self, *, scopes: Optional[List[str]] = None, **kwargs: Any) -> None: - """ - :keyword scopes: A list of the scopes that should be requested while authenticating. - :paramtype scopes: list[str] + :keyword name: Job execution name. + :paramtype name: str + :keyword id: Job execution Id. + :paramtype id: str """ super().__init__(**kwargs) - self.scopes = scopes - - -class ManagedCertificate(TrackedResource): - """Managed certificates used for Custom Domain bindings of Container Apps in a Managed - Environment. + self.name = name + self.id = id - Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to server. +class JobExecutionContainer(_serialization.Model): + """Container Apps Jobs execution container definition. - :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. + :ivar image: Container image tag. + :vartype image: str + :ivar name: Custom container name. :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar properties: Certificate resource specific properties. - :vartype properties: ~azure.mgmt.appcontainers.models.ManagedCertificateProperties + :ivar command: Container start command. + :vartype command: list[str] + :ivar args: Container start command arguments. + :vartype args: list[str] + :ivar env: Container environment variables. + :vartype env: list[~azure.mgmt.appcontainers.models.EnvironmentVar] + :ivar resources: Container resource requirements. + :vartype resources: ~azure.mgmt.appcontainers.models.ContainerResources """ - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "location": {"required": True}, - } - _attribute_map = { - "id": {"key": "id", "type": "str"}, + "image": {"key": "image", "type": "str"}, "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "properties": {"key": "properties", "type": "ManagedCertificateProperties"}, + "command": {"key": "command", "type": "[str]"}, + "args": {"key": "args", "type": "[str]"}, + "env": {"key": "env", "type": "[EnvironmentVar]"}, + "resources": {"key": "resources", "type": "ContainerResources"}, } def __init__( self, *, - location: str, - tags: Optional[Dict[str, str]] = None, - properties: Optional["_models.ManagedCertificateProperties"] = None, + image: Optional[str] = None, + name: Optional[str] = None, + command: Optional[List[str]] = None, + args: Optional[List[str]] = None, + env: Optional[List["_models.EnvironmentVar"]] = None, + resources: Optional["_models.ContainerResources"] = None, **kwargs: Any ) -> None: """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - :keyword properties: Certificate resource specific properties. - :paramtype properties: ~azure.mgmt.appcontainers.models.ManagedCertificateProperties + :keyword image: Container image tag. + :paramtype image: str + :keyword name: Custom container name. + :paramtype name: str + :keyword command: Container start command. + :paramtype command: list[str] + :keyword args: Container start command arguments. + :paramtype args: list[str] + :keyword env: Container environment variables. + :paramtype env: list[~azure.mgmt.appcontainers.models.EnvironmentVar] + :keyword resources: Container resource requirements. + :paramtype resources: ~azure.mgmt.appcontainers.models.ContainerResources """ - super().__init__(tags=tags, location=location, **kwargs) - self.properties = properties - + super().__init__(**kwargs) + self.image = image + self.name = name + self.command = command + self.args = args + self.env = env + self.resources = resources -class ManagedCertificateCollection(_serialization.Model): - """Collection of Managed Certificates. - Variables are only populated by the server, and will be ignored when sending a request. +class JobExecutionNamesCollection(_serialization.Model): + """Container App executions names list. All required parameters must be populated in order to send to server. :ivar value: Collection of resources. Required. - :vartype value: list[~azure.mgmt.appcontainers.models.ManagedCertificate] - :ivar next_link: Link to next page of resources. - :vartype next_link: str + :vartype value: list[~azure.mgmt.appcontainers.models.JobExecutionBase] """ _validation = { "value": {"required": True}, - "next_link": {"readonly": True}, } _attribute_map = { - "value": {"key": "value", "type": "[ManagedCertificate]"}, - "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[JobExecutionBase]"}, } - def __init__(self, *, value: List["_models.ManagedCertificate"], **kwargs: Any) -> None: + def __init__(self, *, value: List["_models.JobExecutionBase"], **kwargs: Any) -> None: """ :keyword value: Collection of resources. Required. - :paramtype value: list[~azure.mgmt.appcontainers.models.ManagedCertificate] + :paramtype value: list[~azure.mgmt.appcontainers.models.JobExecutionBase] """ super().__init__(**kwargs) self.value = value - self.next_link = None -class ManagedCertificatePatch(_serialization.Model): - """A managed certificate to update. +class JobExecutionTemplate(_serialization.Model): + """Job's execution template, containing container configuration for a job's execution. - :ivar tags: Application-specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] + :ivar containers: List of container definitions for the Container Apps Job. + :vartype containers: list[~azure.mgmt.appcontainers.models.JobExecutionContainer] + :ivar init_containers: List of specialized containers that run before job containers. + :vartype init_containers: list[~azure.mgmt.appcontainers.models.JobExecutionContainer] """ _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, + "containers": {"key": "containers", "type": "[JobExecutionContainer]"}, + "init_containers": {"key": "initContainers", "type": "[JobExecutionContainer]"}, } - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: + def __init__( + self, + *, + containers: Optional[List["_models.JobExecutionContainer"]] = None, + init_containers: Optional[List["_models.JobExecutionContainer"]] = None, + **kwargs: Any + ) -> None: """ - :keyword tags: Application-specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] + :keyword containers: List of container definitions for the Container Apps Job. + :paramtype containers: list[~azure.mgmt.appcontainers.models.JobExecutionContainer] + :keyword init_containers: List of specialized containers that run before job containers. + :paramtype init_containers: list[~azure.mgmt.appcontainers.models.JobExecutionContainer] """ super().__init__(**kwargs) - self.tags = tags - + self.containers = containers + self.init_containers = init_containers -class ManagedCertificateProperties(_serialization.Model): - """Certificate resource specific properties. - Variables are only populated by the server, and will be ignored when sending a request. +class JobPatchProperties(_serialization.Model): + """Container Apps Job resource specific properties. - :ivar provisioning_state: Provisioning state of the certificate. Known values are: "Succeeded", - "Failed", "Canceled", "DeleteFailed", and "Pending". - :vartype provisioning_state: str or - ~azure.mgmt.appcontainers.models.CertificateProvisioningState - :ivar subject_name: Subject name of the certificate. - :vartype subject_name: str - :ivar error: Any error occurred during the certificate provision. - :vartype error: str - :ivar domain_control_validation: Selected type of domain control validation for managed - certificates. Known values are: "CNAME", "HTTP", and "TXT". - :vartype domain_control_validation: str or - ~azure.mgmt.appcontainers.models.ManagedCertificateDomainControlValidation - :ivar validation_token: A TXT token used for DNS TXT domain control validation when issuing - this type of managed certificates. - :vartype validation_token: str + :ivar extended_location: The complex type of the extended location. + :vartype extended_location: ~azure.mgmt.appcontainers.models.ExtendedLocation + :ivar identity: Managed identities needed by a container app job to interact with other Azure + services to not maintain any secrets or credentials in code. + :vartype identity: ~azure.mgmt.appcontainers.models.ManagedServiceIdentity + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar properties: + :vartype properties: ~azure.mgmt.appcontainers.models.JobPatchPropertiesProperties """ - _validation = { - "provisioning_state": {"readonly": True}, - "error": {"readonly": True}, - "validation_token": {"readonly": True}, - } - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "subject_name": {"key": "subjectName", "type": "str"}, - "error": {"key": "error", "type": "str"}, - "domain_control_validation": {"key": "domainControlValidation", "type": "str"}, - "validation_token": {"key": "validationToken", "type": "str"}, + "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, + "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, + "tags": {"key": "tags", "type": "{str}"}, + "properties": {"key": "properties", "type": "JobPatchPropertiesProperties"}, } def __init__( self, *, - subject_name: Optional[str] = None, - domain_control_validation: Optional[Union[str, "_models.ManagedCertificateDomainControlValidation"]] = None, + extended_location: Optional["_models.ExtendedLocation"] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, + tags: Optional[Dict[str, str]] = None, + properties: Optional["_models.JobPatchPropertiesProperties"] = None, **kwargs: Any ) -> None: """ - :keyword subject_name: Subject name of the certificate. - :paramtype subject_name: str - :keyword domain_control_validation: Selected type of domain control validation for managed - certificates. Known values are: "CNAME", "HTTP", and "TXT". - :paramtype domain_control_validation: str or - ~azure.mgmt.appcontainers.models.ManagedCertificateDomainControlValidation + :keyword extended_location: The complex type of the extended location. + :paramtype extended_location: ~azure.mgmt.appcontainers.models.ExtendedLocation + :keyword identity: Managed identities needed by a container app job to interact with other + Azure services to not maintain any secrets or credentials in code. + :paramtype identity: ~azure.mgmt.appcontainers.models.ManagedServiceIdentity + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword properties: + :paramtype properties: ~azure.mgmt.appcontainers.models.JobPatchPropertiesProperties """ super().__init__(**kwargs) - self.provisioning_state = None - self.subject_name = subject_name - self.error = None - self.domain_control_validation = domain_control_validation - self.validation_token = None - + self.extended_location = extended_location + self.identity = identity + self.tags = tags + self.properties = properties -class ManagedEnvironment(TrackedResource): - """An environment for hosting container apps. - Variables are only populated by the server, and will be ignored when sending a request. +class JobPatchPropertiesProperties(_serialization.Model): + """JobPatchPropertiesProperties. - All required parameters must be populated in order to send to server. + :ivar environment_id: Resource ID of environment. + :vartype environment_id: str + :ivar configuration: Container Apps Job configuration properties. + :vartype configuration: ~azure.mgmt.appcontainers.models.JobConfiguration + :ivar template: Container Apps job definition. + :vartype template: ~azure.mgmt.appcontainers.models.JobTemplate + :ivar outbound_ip_addresses: Outbound IP Addresses of a container apps job. + :vartype outbound_ip_addresses: list[str] + :ivar event_stream_endpoint: The endpoint of the eventstream of the container apps job. + :vartype event_stream_endpoint: str + """ - :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. + _attribute_map = { + "environment_id": {"key": "environmentId", "type": "str"}, + "configuration": {"key": "configuration", "type": "JobConfiguration"}, + "template": {"key": "template", "type": "JobTemplate"}, + "outbound_ip_addresses": {"key": "outboundIpAddresses", "type": "[str]"}, + "event_stream_endpoint": {"key": "eventStreamEndpoint", "type": "str"}, + } + + def __init__( + self, + *, + environment_id: Optional[str] = None, + configuration: Optional["_models.JobConfiguration"] = None, + template: Optional["_models.JobTemplate"] = None, + outbound_ip_addresses: Optional[List[str]] = None, + event_stream_endpoint: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword environment_id: Resource ID of environment. + :paramtype environment_id: str + :keyword configuration: Container Apps Job configuration properties. + :paramtype configuration: ~azure.mgmt.appcontainers.models.JobConfiguration + :keyword template: Container Apps job definition. + :paramtype template: ~azure.mgmt.appcontainers.models.JobTemplate + :keyword outbound_ip_addresses: Outbound IP Addresses of a container apps job. + :paramtype outbound_ip_addresses: list[str] + :keyword event_stream_endpoint: The endpoint of the eventstream of the container apps job. + :paramtype event_stream_endpoint: str + """ + super().__init__(**kwargs) + self.environment_id = environment_id + self.configuration = configuration + self.template = template + self.outbound_ip_addresses = outbound_ip_addresses + self.event_stream_endpoint = event_stream_endpoint + + +class JobScale(_serialization.Model): + """Scaling configurations for event driven jobs. + + :ivar polling_interval: Interval to check each event source in seconds. Defaults to 30s. + :vartype polling_interval: int + :ivar min_executions: Minimum number of job executions that are created for a trigger, default + 0. + :vartype min_executions: int + :ivar max_executions: Maximum number of job executions that are created for a trigger, default + 100. + :vartype max_executions: int + :ivar rules: Scaling rules. + :vartype rules: list[~azure.mgmt.appcontainers.models.JobScaleRule] + """ + + _attribute_map = { + "polling_interval": {"key": "pollingInterval", "type": "int"}, + "min_executions": {"key": "minExecutions", "type": "int"}, + "max_executions": {"key": "maxExecutions", "type": "int"}, + "rules": {"key": "rules", "type": "[JobScaleRule]"}, + } + + def __init__( + self, + *, + polling_interval: Optional[int] = None, + min_executions: int = 0, + max_executions: int = 100, + rules: Optional[List["_models.JobScaleRule"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword polling_interval: Interval to check each event source in seconds. Defaults to 30s. + :paramtype polling_interval: int + :keyword min_executions: Minimum number of job executions that are created for a trigger, + default 0. + :paramtype min_executions: int + :keyword max_executions: Maximum number of job executions that are created for a trigger, + default 100. + :paramtype max_executions: int + :keyword rules: Scaling rules. + :paramtype rules: list[~azure.mgmt.appcontainers.models.JobScaleRule] + """ + super().__init__(**kwargs) + self.polling_interval = polling_interval + self.min_executions = min_executions + self.max_executions = max_executions + self.rules = rules + + +class JobScaleRule(_serialization.Model): + """Scaling rule. + + :ivar name: Scale Rule Name. :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". + :ivar type: Type of the scale rule + eg: azure-servicebus, redis etc. :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar kind: Kind of the Environment. - :vartype kind: str - :ivar identity: Managed identities for the Managed Environment to interact with other Azure - services without maintaining any secrets or credentials in code. - :vartype identity: ~azure.mgmt.appcontainers.models.ManagedServiceIdentity - :ivar provisioning_state: Provisioning state of the Environment. Known values are: "Succeeded", - "Failed", "Canceled", "Waiting", "InitializationInProgress", "InfrastructureSetupInProgress", - "InfrastructureSetupComplete", "ScheduledForDelete", "UpgradeRequested", and "UpgradeFailed". - :vartype provisioning_state: str or - ~azure.mgmt.appcontainers.models.EnvironmentProvisioningState - :ivar dapr_ai_instrumentation_key: Azure Monitor instrumentation key used by Dapr to export - Service to Service communication telemetry. - :vartype dapr_ai_instrumentation_key: str - :ivar dapr_ai_connection_string: Application Insights connection string used by Dapr to export - Service to Service communication telemetry. - :vartype dapr_ai_connection_string: str - :ivar vnet_configuration: Vnet configuration for the environment. - :vartype vnet_configuration: ~azure.mgmt.appcontainers.models.VnetConfiguration - :ivar deployment_errors: Any errors that occurred during deployment or deployment validation. - :vartype deployment_errors: str - :ivar default_domain: Default Domain Name for the cluster. - :vartype default_domain: str - :ivar static_ip: Static IP of the Environment. - :vartype static_ip: str - :ivar app_logs_configuration: Cluster configuration which enables the log daemon to export app - logs to configured destination. - :vartype app_logs_configuration: ~azure.mgmt.appcontainers.models.AppLogsConfiguration - :ivar zone_redundant: Whether or not this Managed Environment is zone-redundant. - :vartype zone_redundant: bool - :ivar custom_domain_configuration: Custom domain configuration for the environment. - :vartype custom_domain_configuration: - ~azure.mgmt.appcontainers.models.CustomDomainConfiguration - :ivar event_stream_endpoint: The endpoint of the eventstream of the Environment. - :vartype event_stream_endpoint: str - :ivar workload_profiles: Workload profiles configured for the Managed Environment. - :vartype workload_profiles: list[~azure.mgmt.appcontainers.models.WorkloadProfile] - :ivar keda_configuration: The configuration of Keda component. - :vartype keda_configuration: ~azure.mgmt.appcontainers.models.KedaConfiguration - :ivar dapr_configuration: The configuration of Dapr component. - :vartype dapr_configuration: ~azure.mgmt.appcontainers.models.DaprConfiguration - :ivar infrastructure_resource_group: Name of the platform-managed resource group created for - the Managed Environment to host infrastructure resources. If a subnet ID is provided, this - resource group will be created in the same subscription as the subnet. - :vartype infrastructure_resource_group: str - :ivar peer_authentication: Peer authentication settings for the Managed Environment. - :vartype peer_authentication: - ~azure.mgmt.appcontainers.models.ManagedEnvironmentPropertiesPeerAuthentication - :ivar peer_traffic_configuration: Peer traffic settings for the Managed Environment. - :vartype peer_traffic_configuration: - ~azure.mgmt.appcontainers.models.ManagedEnvironmentPropertiesPeerTrafficConfiguration + :ivar metadata: Metadata properties to describe the scale rule. + :vartype metadata: JSON + :ivar auth: Authentication secrets for the scale rule. + :vartype auth: list[~azure.mgmt.appcontainers.models.ScaleRuleAuth] + :ivar identity: The resource ID of a user-assigned managed identity that is assigned to the + job, or 'system' for system-assigned identity. + :vartype identity: str + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "metadata": {"key": "metadata", "type": "object"}, + "auth": {"key": "auth", "type": "[ScaleRuleAuth]"}, + "identity": {"key": "identity", "type": "str"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + type: Optional[str] = None, + metadata: Optional[JSON] = None, + auth: Optional[List["_models.ScaleRuleAuth"]] = None, + identity: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: Scale Rule Name. + :paramtype name: str + :keyword type: Type of the scale rule + eg: azure-servicebus, redis etc. + :paramtype type: str + :keyword metadata: Metadata properties to describe the scale rule. + :paramtype metadata: JSON + :keyword auth: Authentication secrets for the scale rule. + :paramtype auth: list[~azure.mgmt.appcontainers.models.ScaleRuleAuth] + :keyword identity: The resource ID of a user-assigned managed identity that is assigned to the + job, or 'system' for system-assigned identity. + :paramtype identity: str + """ + super().__init__(**kwargs) + self.name = name + self.type = type + self.metadata = metadata + self.auth = auth + self.identity = identity + + +class JobsCollection(_serialization.Model): + """Container Apps Jobs collection ARM resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar value: Collection of resources. Required. + :vartype value: list[~azure.mgmt.appcontainers.models.Job] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[Job]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.Job"], **kwargs: Any) -> None: + """ + :keyword value: Collection of resources. Required. + :paramtype value: list[~azure.mgmt.appcontainers.models.Job] + """ + super().__init__(**kwargs) + self.value = value + self.next_link: Optional[str] = None + + +class JobSecretsCollection(_serialization.Model): + """Container Apps Job Secrets Collection ARM resource. + + All required parameters must be populated in order to send to server. + + :ivar value: Collection of resources. Required. + :vartype value: list[~azure.mgmt.appcontainers.models.Secret] + """ + + _validation = { + "value": {"required": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[Secret]"}, + } + + def __init__(self, *, value: List["_models.Secret"], **kwargs: Any) -> None: + """ + :keyword value: Collection of resources. Required. + :paramtype value: list[~azure.mgmt.appcontainers.models.Secret] + """ + super().__init__(**kwargs) + self.value = value + + +class JobTemplate(_serialization.Model): + """Container Apps Job versioned application definition. Defines the desired state of an immutable + revision. Any changes to this section Will result in a new revision being created. + + :ivar init_containers: List of specialized containers that run before app containers. + :vartype init_containers: list[~azure.mgmt.appcontainers.models.InitContainer] + :ivar containers: List of container definitions for the Container App. + :vartype containers: list[~azure.mgmt.appcontainers.models.Container] + :ivar volumes: List of volume definitions for the Container App. + :vartype volumes: list[~azure.mgmt.appcontainers.models.Volume] + """ + + _attribute_map = { + "init_containers": {"key": "initContainers", "type": "[InitContainer]"}, + "containers": {"key": "containers", "type": "[Container]"}, + "volumes": {"key": "volumes", "type": "[Volume]"}, + } + + def __init__( + self, + *, + init_containers: Optional[List["_models.InitContainer"]] = None, + containers: Optional[List["_models.Container"]] = None, + volumes: Optional[List["_models.Volume"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword init_containers: List of specialized containers that run before app containers. + :paramtype init_containers: list[~azure.mgmt.appcontainers.models.InitContainer] + :keyword containers: List of container definitions for the Container App. + :paramtype containers: list[~azure.mgmt.appcontainers.models.Container] + :keyword volumes: List of volume definitions for the Container App. + :paramtype volumes: list[~azure.mgmt.appcontainers.models.Volume] + """ + super().__init__(**kwargs) + self.init_containers = init_containers + self.containers = containers + self.volumes = volumes + + +class JwtClaimChecks(_serialization.Model): + """The configuration settings of the checks that should be made while validating the JWT Claims. + + :ivar allowed_groups: The list of the allowed groups. + :vartype allowed_groups: list[str] + :ivar allowed_client_applications: The list of the allowed client applications. + :vartype allowed_client_applications: list[str] + """ + + _attribute_map = { + "allowed_groups": {"key": "allowedGroups", "type": "[str]"}, + "allowed_client_applications": {"key": "allowedClientApplications", "type": "[str]"}, + } + + def __init__( + self, + *, + allowed_groups: Optional[List[str]] = None, + allowed_client_applications: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword allowed_groups: The list of the allowed groups. + :paramtype allowed_groups: list[str] + :keyword allowed_client_applications: The list of the allowed client applications. + :paramtype allowed_client_applications: list[str] + """ + super().__init__(**kwargs) + self.allowed_groups = allowed_groups + self.allowed_client_applications = allowed_client_applications + + +class KedaConfiguration(_serialization.Model): + """Configuration properties Keda component. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar version: The version of Keda. + :vartype version: str + """ + + _validation = { + "version": {"readonly": True}, + } + + _attribute_map = { + "version": {"key": "version", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.version: Optional[str] = None + + +class LabelHistory(ProxyResource): + """Container App Label History. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData + :ivar properties: Container App Label History resource specific properties. + :vartype properties: ~azure.mgmt.appcontainers.models.LabelHistoryProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "properties": {"key": "properties", "type": "LabelHistoryProperties"}, + } + + def __init__(self, *, properties: Optional["_models.LabelHistoryProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: Container App Label History resource specific properties. + :paramtype properties: ~azure.mgmt.appcontainers.models.LabelHistoryProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class LabelHistoryCollection(_serialization.Model): + """Container App Label History collection ARM resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar value: Collection of resources. Required. + :vartype value: list[~azure.mgmt.appcontainers.models.LabelHistory] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[LabelHistory]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.LabelHistory"], **kwargs: Any) -> None: + """ + :keyword value: Collection of resources. Required. + :paramtype value: list[~azure.mgmt.appcontainers.models.LabelHistory] + """ + super().__init__(**kwargs) + self.value = value + self.next_link: Optional[str] = None + + +class LabelHistoryProperties(_serialization.Model): + """Container App Label History resource specific properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar records: List of label history records. + :vartype records: list[~azure.mgmt.appcontainers.models.LabelHistoryRecordItem] + """ + + _validation = { + "records": {"readonly": True}, + } + + _attribute_map = { + "records": {"key": "records", "type": "[LabelHistoryRecordItem]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.records: Optional[List["_models.LabelHistoryRecordItem"]] = None + + +class LabelHistoryRecordItem(_serialization.Model): + """Container App Label History Item resource specific properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar revision: Container App revision name that label was applied to. + :vartype revision: str + :ivar start: Timestamp describing when the label was applied to the revision. + :vartype start: ~datetime.datetime + :ivar stop: Timestamp describing when the label was removed from the revision. Only meaningful + when the label is currently applied to the revision. + :vartype stop: ~datetime.datetime + :ivar status: Status of the label history record. Known values are: "Succeeded", "Failed", and + "Starting". + :vartype status: str or ~azure.mgmt.appcontainers.models.Status + """ + + _validation = { + "revision": {"readonly": True}, + "start": {"readonly": True}, + "stop": {"readonly": True}, + "status": {"readonly": True}, + } + + _attribute_map = { + "revision": {"key": "revision", "type": "str"}, + "start": {"key": "start", "type": "iso-8601"}, + "stop": {"key": "stop", "type": "iso-8601"}, + "status": {"key": "status", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.revision: Optional[str] = None + self.start: Optional[datetime.datetime] = None + self.stop: Optional[datetime.datetime] = None + self.status: Optional[Union[str, "_models.Status"]] = None + + +class LifecycleConfiguration(_serialization.Model): + """The lifecycle configuration properties of a session in the dynamic session pool. + + :ivar lifecycle_type: The lifecycle type of the session pool. Known values are: "Timed" and + "OnContainerExit". + :vartype lifecycle_type: str or ~azure.mgmt.appcontainers.models.LifecycleType + :ivar cooldown_period_in_seconds: The cooldown period of a session in seconds when the + lifecycle type is 'Timed'. + :vartype cooldown_period_in_seconds: int + :ivar max_alive_period_in_seconds: The maximum alive period of a session in seconds when the + lifecycle type is 'OnContainerExit'. + :vartype max_alive_period_in_seconds: int + """ + + _attribute_map = { + "lifecycle_type": {"key": "lifecycleType", "type": "str"}, + "cooldown_period_in_seconds": {"key": "cooldownPeriodInSeconds", "type": "int"}, + "max_alive_period_in_seconds": {"key": "maxAlivePeriodInSeconds", "type": "int"}, + } + + def __init__( + self, + *, + lifecycle_type: Optional[Union[str, "_models.LifecycleType"]] = None, + cooldown_period_in_seconds: Optional[int] = None, + max_alive_period_in_seconds: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword lifecycle_type: The lifecycle type of the session pool. Known values are: "Timed" and + "OnContainerExit". + :paramtype lifecycle_type: str or ~azure.mgmt.appcontainers.models.LifecycleType + :keyword cooldown_period_in_seconds: The cooldown period of a session in seconds when the + lifecycle type is 'Timed'. + :paramtype cooldown_period_in_seconds: int + :keyword max_alive_period_in_seconds: The maximum alive period of a session in seconds when the + lifecycle type is 'OnContainerExit'. + :paramtype max_alive_period_in_seconds: int + """ + super().__init__(**kwargs) + self.lifecycle_type = lifecycle_type + self.cooldown_period_in_seconds = cooldown_period_in_seconds + self.max_alive_period_in_seconds = max_alive_period_in_seconds + + +class ListUsagesResult(_serialization.Model): + """ListUsagesResult. + + :ivar value: The list of compute resource usages. + :vartype value: list[~azure.mgmt.appcontainers.models.Usage] + :ivar next_link: The URI to fetch the next page of compute resource usage information. Call + ListNext() with this to fetch the next page of compute resource usage information. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[Usage]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.Usage"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The list of compute resource usages. + :paramtype value: list[~azure.mgmt.appcontainers.models.Usage] + :keyword next_link: The URI to fetch the next page of compute resource usage information. Call + ListNext() with this to fetch the next page of compute resource usage information. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class LogAnalyticsConfiguration(_serialization.Model): + """Log Analytics configuration, must only be provided when destination is configured as + 'log-analytics'. + + :ivar customer_id: Log analytics customer id. + :vartype customer_id: str + :ivar shared_key: Log analytics customer key. + :vartype shared_key: str + :ivar dynamic_json_columns: Boolean indicating whether to parse json string log into dynamic + json columns. + :vartype dynamic_json_columns: bool + """ + + _attribute_map = { + "customer_id": {"key": "customerId", "type": "str"}, + "shared_key": {"key": "sharedKey", "type": "str"}, + "dynamic_json_columns": {"key": "dynamicJsonColumns", "type": "bool"}, + } + + def __init__( + self, + *, + customer_id: Optional[str] = None, + shared_key: Optional[str] = None, + dynamic_json_columns: Optional[bool] = None, + **kwargs: Any + ) -> None: + """ + :keyword customer_id: Log analytics customer id. + :paramtype customer_id: str + :keyword shared_key: Log analytics customer key. + :paramtype shared_key: str + :keyword dynamic_json_columns: Boolean indicating whether to parse json string log into dynamic + json columns. + :paramtype dynamic_json_columns: bool + """ + super().__init__(**kwargs) + self.customer_id = customer_id + self.shared_key = shared_key + self.dynamic_json_columns = dynamic_json_columns + + +class LoggerSetting(_serialization.Model): + """Logger settings for java workloads. + + All required parameters must be populated in order to send to server. + + :ivar logger: Logger name. Required. + :vartype logger: str + :ivar level: The specified logger's log level. Required. Known values are: "off", "error", + "info", "debug", "trace", and "warn". + :vartype level: str or ~azure.mgmt.appcontainers.models.Level + """ + + _validation = { + "logger": {"required": True}, + "level": {"required": True}, + } + + _attribute_map = { + "logger": {"key": "logger", "type": "str"}, + "level": {"key": "level", "type": "str"}, + } + + def __init__(self, *, logger: str, level: Union[str, "_models.Level"], **kwargs: Any) -> None: + """ + :keyword logger: Logger name. Required. + :paramtype logger: str + :keyword level: The specified logger's log level. Required. Known values are: "off", "error", + "info", "debug", "trace", and "warn". + :paramtype level: str or ~azure.mgmt.appcontainers.models.Level + """ + super().__init__(**kwargs) + self.logger = logger + self.level = level + + +class LogicApp(ProxyResource): + """A logic app extension resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData + :ivar properties: The resource-specific properties for this resource. + :vartype properties: JSON + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "properties": {"key": "properties", "type": "object"}, + } + + def __init__(self, *, properties: Optional[JSON] = None, **kwargs: Any) -> None: + """ + :keyword properties: The resource-specific properties for this resource. + :paramtype properties: JSON + """ + super().__init__(**kwargs) + self.properties = properties + + +class Login(_serialization.Model): + """The configuration settings of the login flow of users using ContainerApp Service + Authentication/Authorization. + + :ivar routes: The routes that specify the endpoints used for login and logout requests. + :vartype routes: ~azure.mgmt.appcontainers.models.LoginRoutes + :ivar token_store: The configuration settings of the token store. + :vartype token_store: ~azure.mgmt.appcontainers.models.TokenStore + :ivar preserve_url_fragments_for_logins: :code:`true` if the fragments from the + request are preserved after the login request is made; otherwise, :code:`false`. + :vartype preserve_url_fragments_for_logins: bool + :ivar allowed_external_redirect_urls: External URLs that can be redirected to as part of + logging in or logging out of the app. Note that the query string part of the URL is ignored. + This is an advanced setting typically only needed by Windows Store application backends. + Note that URLs within the current domain are always implicitly allowed. + :vartype allowed_external_redirect_urls: list[str] + :ivar cookie_expiration: The configuration settings of the session cookie's expiration. + :vartype cookie_expiration: ~azure.mgmt.appcontainers.models.CookieExpiration + :ivar nonce: The configuration settings of the nonce used in the login flow. + :vartype nonce: ~azure.mgmt.appcontainers.models.Nonce + """ + + _attribute_map = { + "routes": {"key": "routes", "type": "LoginRoutes"}, + "token_store": {"key": "tokenStore", "type": "TokenStore"}, + "preserve_url_fragments_for_logins": {"key": "preserveUrlFragmentsForLogins", "type": "bool"}, + "allowed_external_redirect_urls": {"key": "allowedExternalRedirectUrls", "type": "[str]"}, + "cookie_expiration": {"key": "cookieExpiration", "type": "CookieExpiration"}, + "nonce": {"key": "nonce", "type": "Nonce"}, + } + + def __init__( + self, + *, + routes: Optional["_models.LoginRoutes"] = None, + token_store: Optional["_models.TokenStore"] = None, + preserve_url_fragments_for_logins: Optional[bool] = None, + allowed_external_redirect_urls: Optional[List[str]] = None, + cookie_expiration: Optional["_models.CookieExpiration"] = None, + nonce: Optional["_models.Nonce"] = None, + **kwargs: Any + ) -> None: + """ + :keyword routes: The routes that specify the endpoints used for login and logout requests. + :paramtype routes: ~azure.mgmt.appcontainers.models.LoginRoutes + :keyword token_store: The configuration settings of the token store. + :paramtype token_store: ~azure.mgmt.appcontainers.models.TokenStore + :keyword preserve_url_fragments_for_logins: :code:`true` if the fragments from the + request are preserved after the login request is made; otherwise, :code:`false`. + :paramtype preserve_url_fragments_for_logins: bool + :keyword allowed_external_redirect_urls: External URLs that can be redirected to as part of + logging in or logging out of the app. Note that the query string part of the URL is ignored. + This is an advanced setting typically only needed by Windows Store application backends. + Note that URLs within the current domain are always implicitly allowed. + :paramtype allowed_external_redirect_urls: list[str] + :keyword cookie_expiration: The configuration settings of the session cookie's expiration. + :paramtype cookie_expiration: ~azure.mgmt.appcontainers.models.CookieExpiration + :keyword nonce: The configuration settings of the nonce used in the login flow. + :paramtype nonce: ~azure.mgmt.appcontainers.models.Nonce + """ + super().__init__(**kwargs) + self.routes = routes + self.token_store = token_store + self.preserve_url_fragments_for_logins = preserve_url_fragments_for_logins + self.allowed_external_redirect_urls = allowed_external_redirect_urls + self.cookie_expiration = cookie_expiration + self.nonce = nonce + + +class LoginRoutes(_serialization.Model): + """The routes that specify the endpoints used for login and logout requests. + + :ivar logout_endpoint: The endpoint at which a logout request should be made. + :vartype logout_endpoint: str + """ + + _attribute_map = { + "logout_endpoint": {"key": "logoutEndpoint", "type": "str"}, + } + + def __init__(self, *, logout_endpoint: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword logout_endpoint: The endpoint at which a logout request should be made. + :paramtype logout_endpoint: str + """ + super().__init__(**kwargs) + self.logout_endpoint = logout_endpoint + + +class LoginScopes(_serialization.Model): + """The configuration settings of the login flow, including the scopes that should be requested. + + :ivar scopes: A list of the scopes that should be requested while authenticating. + :vartype scopes: list[str] + """ + + _attribute_map = { + "scopes": {"key": "scopes", "type": "[str]"}, + } + + def __init__(self, *, scopes: Optional[List[str]] = None, **kwargs: Any) -> None: + """ + :keyword scopes: A list of the scopes that should be requested while authenticating. + :paramtype scopes: list[str] + """ + super().__init__(**kwargs) + self.scopes = scopes + + +class LogsConfiguration(_serialization.Model): + """Configuration of Open Telemetry logs. + + :ivar destinations: Open telemetry logs destinations. + :vartype destinations: list[str] + """ + + _attribute_map = { + "destinations": {"key": "destinations", "type": "[str]"}, + } + + def __init__(self, *, destinations: Optional[List[str]] = None, **kwargs: Any) -> None: + """ + :keyword destinations: Open telemetry logs destinations. + :paramtype destinations: list[str] + """ + super().__init__(**kwargs) + self.destinations = destinations + + +class MaintenanceConfigurationCollection(_serialization.Model): + """The response of list maintenance configuration resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: Results of the list maintenance configuration resources. + :vartype value: list[~azure.mgmt.appcontainers.models.MaintenanceConfigurationResource] + :ivar next_link: Link for next page of results. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[MaintenanceConfigurationResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.MaintenanceConfigurationResource"]] = None, **kwargs: Any + ) -> None: + """ + :keyword value: Results of the list maintenance configuration resources. + :paramtype value: list[~azure.mgmt.appcontainers.models.MaintenanceConfigurationResource] + """ + super().__init__(**kwargs) + self.value = value + self.next_link: Optional[str] = None + + +class MaintenanceConfigurationResource(ProxyResource): + """Information about the Maintenance Configuration resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData + :ivar scheduled_entries: List of maintenance schedules for a managed environment. + :vartype scheduled_entries: list[~azure.mgmt.appcontainers.models.ScheduledEntry] + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "scheduled_entries": {"key": "properties.scheduledEntries", "type": "[ScheduledEntry]"}, + } + + def __init__(self, *, scheduled_entries: Optional[List["_models.ScheduledEntry"]] = None, **kwargs: Any) -> None: + """ + :keyword scheduled_entries: List of maintenance schedules for a managed environment. + :paramtype scheduled_entries: list[~azure.mgmt.appcontainers.models.ScheduledEntry] + """ + super().__init__(**kwargs) + self.scheduled_entries = scheduled_entries + + +class ManagedCertificate(TrackedResource): + """Managed certificates used for Custom Domain bindings of Container Apps in a Managed + Environment. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar properties: Certificate resource specific properties. + :vartype properties: ~azure.mgmt.appcontainers.models.ManagedCertificateProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "properties": {"key": "properties", "type": "ManagedCertificateProperties"}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + properties: Optional["_models.ManagedCertificateProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str + :keyword properties: Certificate resource specific properties. + :paramtype properties: ~azure.mgmt.appcontainers.models.ManagedCertificateProperties + """ + super().__init__(tags=tags, location=location, **kwargs) + self.properties = properties + + +class ManagedCertificateCollection(_serialization.Model): + """Collection of Managed Certificates. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar value: Collection of resources. Required. + :vartype value: list[~azure.mgmt.appcontainers.models.ManagedCertificate] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[ManagedCertificate]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.ManagedCertificate"], **kwargs: Any) -> None: + """ + :keyword value: Collection of resources. Required. + :paramtype value: list[~azure.mgmt.appcontainers.models.ManagedCertificate] + """ + super().__init__(**kwargs) + self.value = value + self.next_link: Optional[str] = None + + +class ManagedCertificatePatch(_serialization.Model): + """A managed certificate to update. + + :ivar tags: Application-specific metadata in the form of key-value pairs. + :vartype tags: dict[str, str] + """ + + _attribute_map = { + "tags": {"key": "tags", "type": "{str}"}, + } + + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: + """ + :keyword tags: Application-specific metadata in the form of key-value pairs. + :paramtype tags: dict[str, str] + """ + super().__init__(**kwargs) + self.tags = tags + + +class ManagedCertificateProperties(_serialization.Model): + """Certificate resource specific properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: Provisioning state of the certificate. Known values are: "Succeeded", + "Failed", "Canceled", "DeleteFailed", "Pending", and "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.appcontainers.models.CertificateProvisioningState + :ivar subject_name: Subject name of the certificate. + :vartype subject_name: str + :ivar error: Any error occurred during the certificate provision. + :vartype error: str + :ivar domain_control_validation: Selected type of domain control validation for managed + certificates. Known values are: "CNAME", "HTTP", and "TXT". + :vartype domain_control_validation: str or + ~azure.mgmt.appcontainers.models.ManagedCertificateDomainControlValidation + :ivar validation_token: A TXT token used for DNS TXT domain control validation when issuing + this type of managed certificates. + :vartype validation_token: str + """ + + _validation = { + "provisioning_state": {"readonly": True}, + "error": {"readonly": True}, + "validation_token": {"readonly": True}, + } + + _attribute_map = { + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "subject_name": {"key": "subjectName", "type": "str"}, + "error": {"key": "error", "type": "str"}, + "domain_control_validation": {"key": "domainControlValidation", "type": "str"}, + "validation_token": {"key": "validationToken", "type": "str"}, + } + + def __init__( + self, + *, + subject_name: Optional[str] = None, + domain_control_validation: Optional[Union[str, "_models.ManagedCertificateDomainControlValidation"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword subject_name: Subject name of the certificate. + :paramtype subject_name: str + :keyword domain_control_validation: Selected type of domain control validation for managed + certificates. Known values are: "CNAME", "HTTP", and "TXT". + :paramtype domain_control_validation: str or + ~azure.mgmt.appcontainers.models.ManagedCertificateDomainControlValidation + """ + super().__init__(**kwargs) + self.provisioning_state: Optional[Union[str, "_models.CertificateProvisioningState"]] = None + self.subject_name = subject_name + self.error: Optional[str] = None + self.domain_control_validation = domain_control_validation + self.validation_token: Optional[str] = None + + +class ManagedEnvironment(TrackedResource): + """An environment for hosting container apps. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar kind: Kind of the Environment. + :vartype kind: str + :ivar identity: Managed identities for the Managed Environment to interact with other Azure + services without maintaining any secrets or credentials in code. + :vartype identity: ~azure.mgmt.appcontainers.models.ManagedServiceIdentity + :ivar provisioning_state: Provisioning state of the Environment. Known values are: "Succeeded", + "Failed", "Canceled", "Waiting", "InitializationInProgress", "InfrastructureSetupInProgress", + "InfrastructureSetupComplete", "ScheduledForDelete", "UpgradeRequested", and "UpgradeFailed". + :vartype provisioning_state: str or + ~azure.mgmt.appcontainers.models.EnvironmentProvisioningState + :ivar dapr_ai_instrumentation_key: Azure Monitor instrumentation key used by Dapr to export + Service to Service communication telemetry. + :vartype dapr_ai_instrumentation_key: str + :ivar dapr_ai_connection_string: Application Insights connection string used by Dapr to export + Service to Service communication telemetry. + :vartype dapr_ai_connection_string: str + :ivar vnet_configuration: Vnet configuration for the environment. + :vartype vnet_configuration: ~azure.mgmt.appcontainers.models.VnetConfiguration + :ivar deployment_errors: Any errors that occurred during deployment or deployment validation. + :vartype deployment_errors: str + :ivar default_domain: Default Domain Name for the cluster. + :vartype default_domain: str + :ivar private_link_default_domain: Private Link Default Domain Name for the environment. + :vartype private_link_default_domain: str + :ivar static_ip: Static IP of the Environment. + :vartype static_ip: str + :ivar app_logs_configuration: Cluster configuration which enables the log daemon to export app + logs to configured destination. + :vartype app_logs_configuration: ~azure.mgmt.appcontainers.models.AppLogsConfiguration + :ivar app_insights_configuration: Environment level Application Insights configuration. + :vartype app_insights_configuration: ~azure.mgmt.appcontainers.models.AppInsightsConfiguration + :ivar open_telemetry_configuration: Environment Open Telemetry configuration. + :vartype open_telemetry_configuration: + ~azure.mgmt.appcontainers.models.OpenTelemetryConfiguration + :ivar zone_redundant: Whether or not this Managed Environment is zone-redundant. + :vartype zone_redundant: bool + :ivar availability_zones: The list of availability zones to use for managed environment. + :vartype availability_zones: list[str] + :ivar custom_domain_configuration: Custom domain configuration for the environment. + :vartype custom_domain_configuration: + ~azure.mgmt.appcontainers.models.CustomDomainConfiguration + :ivar event_stream_endpoint: The endpoint of the eventstream of the Environment. + :vartype event_stream_endpoint: str + :ivar workload_profiles: Workload profiles configured for the Managed Environment. + :vartype workload_profiles: list[~azure.mgmt.appcontainers.models.WorkloadProfile] + :ivar keda_configuration: The configuration of Keda component. + :vartype keda_configuration: ~azure.mgmt.appcontainers.models.KedaConfiguration + :ivar dapr_configuration: The configuration of Dapr component. + :vartype dapr_configuration: ~azure.mgmt.appcontainers.models.DaprConfiguration + :ivar infrastructure_resource_group: Name of the platform-managed resource group created for + the Managed Environment to host infrastructure resources. If a subnet ID is provided, this + resource group will be created in the same subscription as the subnet. + :vartype infrastructure_resource_group: str + :ivar peer_authentication: Peer authentication settings for the Managed Environment. + :vartype peer_authentication: + ~azure.mgmt.appcontainers.models.ManagedEnvironmentPropertiesPeerAuthentication + :ivar peer_traffic_configuration: Peer traffic settings for the Managed Environment. + :vartype peer_traffic_configuration: + ~azure.mgmt.appcontainers.models.ManagedEnvironmentPropertiesPeerTrafficConfiguration + :ivar ingress_configuration: Ingress configuration for the Managed Environment. + :vartype ingress_configuration: ~azure.mgmt.appcontainers.models.IngressConfiguration + :ivar private_endpoint_connections: Private endpoint connections to the resource. + :vartype private_endpoint_connections: + list[~azure.mgmt.appcontainers.models.PrivateEndpointConnection] + :ivar public_network_access: Property to allow or block all public traffic. Allowed Values: + 'Enabled', 'Disabled'. Known values are: "Enabled" and "Disabled". + :vartype public_network_access: str or ~azure.mgmt.appcontainers.models.PublicNetworkAccess + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, + "provisioning_state": {"readonly": True}, + "deployment_errors": {"readonly": True}, + "default_domain": {"readonly": True}, + "private_link_default_domain": {"readonly": True}, + "static_ip": {"readonly": True}, + "event_stream_endpoint": {"readonly": True}, + "private_endpoint_connections": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "kind": {"key": "kind", "type": "str"}, + "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "dapr_ai_instrumentation_key": {"key": "properties.daprAIInstrumentationKey", "type": "str"}, + "dapr_ai_connection_string": {"key": "properties.daprAIConnectionString", "type": "str"}, + "vnet_configuration": {"key": "properties.vnetConfiguration", "type": "VnetConfiguration"}, + "deployment_errors": {"key": "properties.deploymentErrors", "type": "str"}, + "default_domain": {"key": "properties.defaultDomain", "type": "str"}, + "private_link_default_domain": {"key": "properties.privateLinkDefaultDomain", "type": "str"}, + "static_ip": {"key": "properties.staticIp", "type": "str"}, + "app_logs_configuration": {"key": "properties.appLogsConfiguration", "type": "AppLogsConfiguration"}, + "app_insights_configuration": { + "key": "properties.appInsightsConfiguration", + "type": "AppInsightsConfiguration", + }, + "open_telemetry_configuration": { + "key": "properties.openTelemetryConfiguration", + "type": "OpenTelemetryConfiguration", + }, + "zone_redundant": {"key": "properties.zoneRedundant", "type": "bool"}, + "availability_zones": {"key": "properties.availabilityZones", "type": "[str]"}, + "custom_domain_configuration": { + "key": "properties.customDomainConfiguration", + "type": "CustomDomainConfiguration", + }, + "event_stream_endpoint": {"key": "properties.eventStreamEndpoint", "type": "str"}, + "workload_profiles": {"key": "properties.workloadProfiles", "type": "[WorkloadProfile]"}, + "keda_configuration": {"key": "properties.kedaConfiguration", "type": "KedaConfiguration"}, + "dapr_configuration": {"key": "properties.daprConfiguration", "type": "DaprConfiguration"}, + "infrastructure_resource_group": {"key": "properties.infrastructureResourceGroup", "type": "str"}, + "peer_authentication": { + "key": "properties.peerAuthentication", + "type": "ManagedEnvironmentPropertiesPeerAuthentication", + }, + "peer_traffic_configuration": { + "key": "properties.peerTrafficConfiguration", + "type": "ManagedEnvironmentPropertiesPeerTrafficConfiguration", + }, + "ingress_configuration": {"key": "properties.ingressConfiguration", "type": "IngressConfiguration"}, + "private_endpoint_connections": { + "key": "properties.privateEndpointConnections", + "type": "[PrivateEndpointConnection]", + }, + "public_network_access": {"key": "properties.publicNetworkAccess", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + kind: Optional[str] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, + dapr_ai_instrumentation_key: Optional[str] = None, + dapr_ai_connection_string: Optional[str] = None, + vnet_configuration: Optional["_models.VnetConfiguration"] = None, + app_logs_configuration: Optional["_models.AppLogsConfiguration"] = None, + app_insights_configuration: Optional["_models.AppInsightsConfiguration"] = None, + open_telemetry_configuration: Optional["_models.OpenTelemetryConfiguration"] = None, + zone_redundant: Optional[bool] = None, + availability_zones: Optional[List[str]] = None, + custom_domain_configuration: Optional["_models.CustomDomainConfiguration"] = None, + workload_profiles: Optional[List["_models.WorkloadProfile"]] = None, + keda_configuration: Optional["_models.KedaConfiguration"] = None, + dapr_configuration: Optional["_models.DaprConfiguration"] = None, + infrastructure_resource_group: Optional[str] = None, + peer_authentication: Optional["_models.ManagedEnvironmentPropertiesPeerAuthentication"] = None, + peer_traffic_configuration: Optional["_models.ManagedEnvironmentPropertiesPeerTrafficConfiguration"] = None, + ingress_configuration: Optional["_models.IngressConfiguration"] = None, + public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str + :keyword kind: Kind of the Environment. + :paramtype kind: str + :keyword identity: Managed identities for the Managed Environment to interact with other Azure + services without maintaining any secrets or credentials in code. + :paramtype identity: ~azure.mgmt.appcontainers.models.ManagedServiceIdentity + :keyword dapr_ai_instrumentation_key: Azure Monitor instrumentation key used by Dapr to export + Service to Service communication telemetry. + :paramtype dapr_ai_instrumentation_key: str + :keyword dapr_ai_connection_string: Application Insights connection string used by Dapr to + export Service to Service communication telemetry. + :paramtype dapr_ai_connection_string: str + :keyword vnet_configuration: Vnet configuration for the environment. + :paramtype vnet_configuration: ~azure.mgmt.appcontainers.models.VnetConfiguration + :keyword app_logs_configuration: Cluster configuration which enables the log daemon to export + app logs to configured destination. + :paramtype app_logs_configuration: ~azure.mgmt.appcontainers.models.AppLogsConfiguration + :keyword app_insights_configuration: Environment level Application Insights configuration. + :paramtype app_insights_configuration: + ~azure.mgmt.appcontainers.models.AppInsightsConfiguration + :keyword open_telemetry_configuration: Environment Open Telemetry configuration. + :paramtype open_telemetry_configuration: + ~azure.mgmt.appcontainers.models.OpenTelemetryConfiguration + :keyword zone_redundant: Whether or not this Managed Environment is zone-redundant. + :paramtype zone_redundant: bool + :keyword availability_zones: The list of availability zones to use for managed environment. + :paramtype availability_zones: list[str] + :keyword custom_domain_configuration: Custom domain configuration for the environment. + :paramtype custom_domain_configuration: + ~azure.mgmt.appcontainers.models.CustomDomainConfiguration + :keyword workload_profiles: Workload profiles configured for the Managed Environment. + :paramtype workload_profiles: list[~azure.mgmt.appcontainers.models.WorkloadProfile] + :keyword keda_configuration: The configuration of Keda component. + :paramtype keda_configuration: ~azure.mgmt.appcontainers.models.KedaConfiguration + :keyword dapr_configuration: The configuration of Dapr component. + :paramtype dapr_configuration: ~azure.mgmt.appcontainers.models.DaprConfiguration + :keyword infrastructure_resource_group: Name of the platform-managed resource group created for + the Managed Environment to host infrastructure resources. If a subnet ID is provided, this + resource group will be created in the same subscription as the subnet. + :paramtype infrastructure_resource_group: str + :keyword peer_authentication: Peer authentication settings for the Managed Environment. + :paramtype peer_authentication: + ~azure.mgmt.appcontainers.models.ManagedEnvironmentPropertiesPeerAuthentication + :keyword peer_traffic_configuration: Peer traffic settings for the Managed Environment. + :paramtype peer_traffic_configuration: + ~azure.mgmt.appcontainers.models.ManagedEnvironmentPropertiesPeerTrafficConfiguration + :keyword ingress_configuration: Ingress configuration for the Managed Environment. + :paramtype ingress_configuration: ~azure.mgmt.appcontainers.models.IngressConfiguration + :keyword public_network_access: Property to allow or block all public traffic. Allowed Values: + 'Enabled', 'Disabled'. Known values are: "Enabled" and "Disabled". + :paramtype public_network_access: str or ~azure.mgmt.appcontainers.models.PublicNetworkAccess + """ + super().__init__(tags=tags, location=location, **kwargs) + self.kind = kind + self.identity = identity + self.provisioning_state: Optional[Union[str, "_models.EnvironmentProvisioningState"]] = None + self.dapr_ai_instrumentation_key = dapr_ai_instrumentation_key + self.dapr_ai_connection_string = dapr_ai_connection_string + self.vnet_configuration = vnet_configuration + self.deployment_errors: Optional[str] = None + self.default_domain: Optional[str] = None + self.private_link_default_domain: Optional[str] = None + self.static_ip: Optional[str] = None + self.app_logs_configuration = app_logs_configuration + self.app_insights_configuration = app_insights_configuration + self.open_telemetry_configuration = open_telemetry_configuration + self.zone_redundant = zone_redundant + self.availability_zones = availability_zones + self.custom_domain_configuration = custom_domain_configuration + self.event_stream_endpoint: Optional[str] = None + self.workload_profiles = workload_profiles + self.keda_configuration = keda_configuration + self.dapr_configuration = dapr_configuration + self.infrastructure_resource_group = infrastructure_resource_group + self.peer_authentication = peer_authentication + self.peer_traffic_configuration = peer_traffic_configuration + self.ingress_configuration = ingress_configuration + self.private_endpoint_connections: Optional[List["_models.PrivateEndpointConnection"]] = None + self.public_network_access = public_network_access + + +class ManagedEnvironmentPropertiesPeerAuthentication(_serialization.Model): # pylint: disable=name-too-long + """Peer authentication settings for the Managed Environment. + + :ivar mtls: Mutual TLS authentication settings for the Managed Environment. + :vartype mtls: ~azure.mgmt.appcontainers.models.Mtls + """ + + _attribute_map = { + "mtls": {"key": "mtls", "type": "Mtls"}, + } + + def __init__(self, *, mtls: Optional["_models.Mtls"] = None, **kwargs: Any) -> None: + """ + :keyword mtls: Mutual TLS authentication settings for the Managed Environment. + :paramtype mtls: ~azure.mgmt.appcontainers.models.Mtls + """ + super().__init__(**kwargs) + self.mtls = mtls + + +class ManagedEnvironmentPropertiesPeerTrafficConfiguration(_serialization.Model): # pylint: disable=name-too-long + """Peer traffic settings for the Managed Environment. + + :ivar encryption: Peer traffic encryption settings for the Managed Environment. + :vartype encryption: + ~azure.mgmt.appcontainers.models.ManagedEnvironmentPropertiesPeerTrafficConfigurationEncryption + """ + + _attribute_map = { + "encryption": {"key": "encryption", "type": "ManagedEnvironmentPropertiesPeerTrafficConfigurationEncryption"}, + } + + def __init__( + self, + *, + encryption: Optional["_models.ManagedEnvironmentPropertiesPeerTrafficConfigurationEncryption"] = None, + **kwargs: Any + ) -> None: + """ + :keyword encryption: Peer traffic encryption settings for the Managed Environment. + :paramtype encryption: + ~azure.mgmt.appcontainers.models.ManagedEnvironmentPropertiesPeerTrafficConfigurationEncryption + """ + super().__init__(**kwargs) + self.encryption = encryption + + +class ManagedEnvironmentPropertiesPeerTrafficConfigurationEncryption( + _serialization.Model +): # pylint: disable=name-too-long + """Peer traffic encryption settings for the Managed Environment. + + :ivar enabled: Boolean indicating whether the peer traffic encryption is enabled. + :vartype enabled: bool + """ + + _attribute_map = { + "enabled": {"key": "enabled", "type": "bool"}, + } + + def __init__(self, *, enabled: Optional[bool] = None, **kwargs: Any) -> None: + """ + :keyword enabled: Boolean indicating whether the peer traffic encryption is enabled. + :paramtype enabled: bool + """ + super().__init__(**kwargs) + self.enabled = enabled + + +class ManagedEnvironmentsCollection(_serialization.Model): + """Collection of Environments. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar value: Collection of resources. Required. + :vartype value: list[~azure.mgmt.appcontainers.models.ManagedEnvironment] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[ManagedEnvironment]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.ManagedEnvironment"], **kwargs: Any) -> None: + """ + :keyword value: Collection of resources. Required. + :paramtype value: list[~azure.mgmt.appcontainers.models.ManagedEnvironment] + """ + super().__init__(**kwargs) + self.value = value + self.next_link: Optional[str] = None + + +class ManagedEnvironmentStorage(ProxyResource): + """Storage resource for managedEnvironment. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData + :ivar properties: Storage properties. + :vartype properties: ~azure.mgmt.appcontainers.models.ManagedEnvironmentStorageProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "properties": {"key": "properties", "type": "ManagedEnvironmentStorageProperties"}, + } + + def __init__( + self, *, properties: Optional["_models.ManagedEnvironmentStorageProperties"] = None, **kwargs: Any + ) -> None: + """ + :keyword properties: Storage properties. + :paramtype properties: ~azure.mgmt.appcontainers.models.ManagedEnvironmentStorageProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class ManagedEnvironmentStorageProperties(_serialization.Model): + """Storage properties. + + :ivar azure_file: Azure file properties. + :vartype azure_file: ~azure.mgmt.appcontainers.models.AzureFileProperties + :ivar nfs_azure_file: NFS Azure file properties. + :vartype nfs_azure_file: ~azure.mgmt.appcontainers.models.NfsAzureFileProperties + """ + + _attribute_map = { + "azure_file": {"key": "azureFile", "type": "AzureFileProperties"}, + "nfs_azure_file": {"key": "nfsAzureFile", "type": "NfsAzureFileProperties"}, + } + + def __init__( + self, + *, + azure_file: Optional["_models.AzureFileProperties"] = None, + nfs_azure_file: Optional["_models.NfsAzureFileProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword azure_file: Azure file properties. + :paramtype azure_file: ~azure.mgmt.appcontainers.models.AzureFileProperties + :keyword nfs_azure_file: NFS Azure file properties. + :paramtype nfs_azure_file: ~azure.mgmt.appcontainers.models.NfsAzureFileProperties + """ + super().__init__(**kwargs) + self.azure_file = azure_file + self.nfs_azure_file = nfs_azure_file + + +class ManagedEnvironmentStoragesCollection(_serialization.Model): + """Collection of Storage for Environments. + + All required parameters must be populated in order to send to server. + + :ivar value: Collection of storage resources. Required. + :vartype value: list[~azure.mgmt.appcontainers.models.ManagedEnvironmentStorage] + """ + + _validation = { + "value": {"required": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[ManagedEnvironmentStorage]"}, + } + + def __init__(self, *, value: List["_models.ManagedEnvironmentStorage"], **kwargs: Any) -> None: + """ + :keyword value: Collection of storage resources. Required. + :paramtype value: list[~azure.mgmt.appcontainers.models.ManagedEnvironmentStorage] + """ + super().__init__(**kwargs) + self.value = value + + +class ManagedIdentitySetting(_serialization.Model): + """Optional settings for a Managed Identity that is assigned to the Session pool. + + All required parameters must be populated in order to send to server. + + :ivar identity: The resource ID of a user-assigned managed identity that is assigned to the + Session Pool, or 'system' for system-assigned identity. Required. + :vartype identity: str + :ivar lifecycle: Use to select the lifecycle stages of a Session Pool during which the Managed + Identity should be available. Known values are: "Init", "Main", "None", and "All". + :vartype lifecycle: str or ~azure.mgmt.appcontainers.models.IdentitySettingsLifeCycle + """ + + _validation = { + "identity": {"required": True}, + } + + _attribute_map = { + "identity": {"key": "identity", "type": "str"}, + "lifecycle": {"key": "lifecycle", "type": "str"}, + } + + def __init__( + self, + *, + identity: str, + lifecycle: Optional[Union[str, "_models.IdentitySettingsLifeCycle"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword identity: The resource ID of a user-assigned managed identity that is assigned to the + Session Pool, or 'system' for system-assigned identity. Required. + :paramtype identity: str + :keyword lifecycle: Use to select the lifecycle stages of a Session Pool during which the + Managed Identity should be available. Known values are: "Init", "Main", "None", and "All". + :paramtype lifecycle: str or ~azure.mgmt.appcontainers.models.IdentitySettingsLifeCycle + """ + super().__init__(**kwargs) + self.identity = identity + self.lifecycle = lifecycle + + +class ManagedServiceIdentity(_serialization.Model): + """Managed service identity (system assigned and/or user assigned identities). + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar principal_id: The service principal ID of the system assigned identity. This property + will only be provided for a system assigned identity. + :vartype principal_id: str + :ivar tenant_id: The tenant ID of the system assigned identity. This property will only be + provided for a system assigned identity. + :vartype tenant_id: str + :ivar type: Type of managed service identity (where both SystemAssigned and UserAssigned types + are allowed). Required. Known values are: "None", "SystemAssigned", "UserAssigned", and + "SystemAssigned,UserAssigned". + :vartype type: str or ~azure.mgmt.appcontainers.models.ManagedServiceIdentityType + :ivar user_assigned_identities: The set of user assigned identities associated with the + resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + The dictionary values can be empty objects ({}) in requests. + :vartype user_assigned_identities: dict[str, + ~azure.mgmt.appcontainers.models.UserAssignedIdentity] + """ + + _validation = { + "principal_id": {"readonly": True}, + "tenant_id": {"readonly": True}, + "type": {"required": True}, + } + + _attribute_map = { + "principal_id": {"key": "principalId", "type": "str"}, + "tenant_id": {"key": "tenantId", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "user_assigned_identities": {"key": "userAssignedIdentities", "type": "{UserAssignedIdentity}"}, + } + + def __init__( + self, + *, + type: Union[str, "_models.ManagedServiceIdentityType"], + user_assigned_identities: Optional[Dict[str, "_models.UserAssignedIdentity"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword type: Type of managed service identity (where both SystemAssigned and UserAssigned + types are allowed). Required. Known values are: "None", "SystemAssigned", "UserAssigned", and + "SystemAssigned,UserAssigned". + :paramtype type: str or ~azure.mgmt.appcontainers.models.ManagedServiceIdentityType + :keyword user_assigned_identities: The set of user assigned identities associated with the + resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + The dictionary values can be empty objects ({}) in requests. + :paramtype user_assigned_identities: dict[str, + ~azure.mgmt.appcontainers.models.UserAssignedIdentity] + """ + super().__init__(**kwargs) + self.principal_id: Optional[str] = None + self.tenant_id: Optional[str] = None + self.type = type + self.user_assigned_identities = user_assigned_identities + + +class MetricsConfiguration(_serialization.Model): + """Configuration of Open Telemetry metrics. + + :ivar include_keda: Boolean indicating if including keda metrics. + :vartype include_keda: bool + :ivar destinations: Open telemetry metrics destinations. + :vartype destinations: list[str] + """ + + _attribute_map = { + "include_keda": {"key": "includeKeda", "type": "bool"}, + "destinations": {"key": "destinations", "type": "[str]"}, + } + + def __init__( + self, *, include_keda: Optional[bool] = None, destinations: Optional[List[str]] = None, **kwargs: Any + ) -> None: + """ + :keyword include_keda: Boolean indicating if including keda metrics. + :paramtype include_keda: bool + :keyword destinations: Open telemetry metrics destinations. + :paramtype destinations: list[str] + """ + super().__init__(**kwargs) + self.include_keda = include_keda + self.destinations = destinations + + +class Mtls(_serialization.Model): + """Configuration properties for mutual TLS authentication. + + :ivar enabled: Boolean indicating whether the mutual TLS authentication is enabled. + :vartype enabled: bool + """ + + _attribute_map = { + "enabled": {"key": "enabled", "type": "bool"}, + } + + def __init__(self, *, enabled: Optional[bool] = None, **kwargs: Any) -> None: + """ + :keyword enabled: Boolean indicating whether the mutual TLS authentication is enabled. + :paramtype enabled: bool + """ + super().__init__(**kwargs) + self.enabled = enabled + + +class NacosComponent(JavaComponentProperties): + """Nacos properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar component_type: Type of the Java Component. Required. Known values are: + "SpringBootAdmin", "SpringCloudEureka", "SpringCloudConfig", "SpringCloudGateway", and "Nacos". + :vartype component_type: str or ~azure.mgmt.appcontainers.models.JavaComponentType + :ivar provisioning_state: Provisioning state of the Java Component. Known values are: + "Succeeded", "Failed", "Canceled", "Deleting", and "InProgress". + :vartype provisioning_state: str or + ~azure.mgmt.appcontainers.models.JavaComponentProvisioningState + :ivar configurations: List of Java Components configuration properties. + :vartype configurations: + list[~azure.mgmt.appcontainers.models.JavaComponentConfigurationProperty] + :ivar scale: Java component scaling configurations. + :vartype scale: ~azure.mgmt.appcontainers.models.JavaComponentPropertiesScale + :ivar service_binds: List of Java Components that are bound to the Java component. + :vartype service_binds: list[~azure.mgmt.appcontainers.models.JavaComponentServiceBind] + :ivar ingress: Java Component Ingress configurations. + :vartype ingress: ~azure.mgmt.appcontainers.models.JavaComponentIngress + """ + + _validation = { + "component_type": {"required": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "component_type": {"key": "componentType", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "configurations": {"key": "configurations", "type": "[JavaComponentConfigurationProperty]"}, + "scale": {"key": "scale", "type": "JavaComponentPropertiesScale"}, + "service_binds": {"key": "serviceBinds", "type": "[JavaComponentServiceBind]"}, + "ingress": {"key": "ingress", "type": "JavaComponentIngress"}, + } + + def __init__( + self, + *, + configurations: Optional[List["_models.JavaComponentConfigurationProperty"]] = None, + scale: Optional["_models.JavaComponentPropertiesScale"] = None, + service_binds: Optional[List["_models.JavaComponentServiceBind"]] = None, + ingress: Optional["_models.JavaComponentIngress"] = None, + **kwargs: Any + ) -> None: + """ + :keyword configurations: List of Java Components configuration properties. + :paramtype configurations: + list[~azure.mgmt.appcontainers.models.JavaComponentConfigurationProperty] + :keyword scale: Java component scaling configurations. + :paramtype scale: ~azure.mgmt.appcontainers.models.JavaComponentPropertiesScale + :keyword service_binds: List of Java Components that are bound to the Java component. + :paramtype service_binds: list[~azure.mgmt.appcontainers.models.JavaComponentServiceBind] + :keyword ingress: Java Component Ingress configurations. + :paramtype ingress: ~azure.mgmt.appcontainers.models.JavaComponentIngress + """ + super().__init__(configurations=configurations, scale=scale, service_binds=service_binds, **kwargs) + self.component_type: str = "Nacos" + self.ingress = ingress + + +class NfsAzureFileProperties(_serialization.Model): + """NFS Azure File Properties. + + :ivar server: Server for NFS azure file. + :vartype server: str + :ivar access_mode: Access mode for storage. Known values are: "ReadOnly" and "ReadWrite". + :vartype access_mode: str or ~azure.mgmt.appcontainers.models.AccessMode + :ivar share_name: NFS Azure file share name. + :vartype share_name: str """ - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "location": {"required": True}, - "provisioning_state": {"readonly": True}, - "deployment_errors": {"readonly": True}, - "default_domain": {"readonly": True}, - "static_ip": {"readonly": True}, - "event_stream_endpoint": {"readonly": True}, + _attribute_map = { + "server": {"key": "server", "type": "str"}, + "access_mode": {"key": "accessMode", "type": "str"}, + "share_name": {"key": "shareName", "type": "str"}, } + def __init__( + self, + *, + server: Optional[str] = None, + access_mode: Optional[Union[str, "_models.AccessMode"]] = None, + share_name: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword server: Server for NFS azure file. + :paramtype server: str + :keyword access_mode: Access mode for storage. Known values are: "ReadOnly" and "ReadWrite". + :paramtype access_mode: str or ~azure.mgmt.appcontainers.models.AccessMode + :keyword share_name: NFS Azure file share name. + :paramtype share_name: str + """ + super().__init__(**kwargs) + self.server = server + self.access_mode = access_mode + self.share_name = share_name + + +class Nonce(_serialization.Model): + """The configuration settings of the nonce used in the login flow. + + :ivar validate_nonce: :code:`false` if the nonce should not be validated while + completing the login flow; otherwise, :code:`true`. + :vartype validate_nonce: bool + :ivar nonce_expiration_interval: The time after the request is made when the nonce should + expire. + :vartype nonce_expiration_interval: str + """ + _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "kind": {"key": "kind", "type": "str"}, - "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "dapr_ai_instrumentation_key": {"key": "properties.daprAIInstrumentationKey", "type": "str"}, - "dapr_ai_connection_string": {"key": "properties.daprAIConnectionString", "type": "str"}, - "vnet_configuration": {"key": "properties.vnetConfiguration", "type": "VnetConfiguration"}, - "deployment_errors": {"key": "properties.deploymentErrors", "type": "str"}, - "default_domain": {"key": "properties.defaultDomain", "type": "str"}, - "static_ip": {"key": "properties.staticIp", "type": "str"}, - "app_logs_configuration": {"key": "properties.appLogsConfiguration", "type": "AppLogsConfiguration"}, - "zone_redundant": {"key": "properties.zoneRedundant", "type": "bool"}, - "custom_domain_configuration": { - "key": "properties.customDomainConfiguration", - "type": "CustomDomainConfiguration", - }, - "event_stream_endpoint": {"key": "properties.eventStreamEndpoint", "type": "str"}, - "workload_profiles": {"key": "properties.workloadProfiles", "type": "[WorkloadProfile]"}, - "keda_configuration": {"key": "properties.kedaConfiguration", "type": "KedaConfiguration"}, - "dapr_configuration": {"key": "properties.daprConfiguration", "type": "DaprConfiguration"}, - "infrastructure_resource_group": {"key": "properties.infrastructureResourceGroup", "type": "str"}, - "peer_authentication": { - "key": "properties.peerAuthentication", - "type": "ManagedEnvironmentPropertiesPeerAuthentication", - }, - "peer_traffic_configuration": { - "key": "properties.peerTrafficConfiguration", - "type": "ManagedEnvironmentPropertiesPeerTrafficConfiguration", - }, + "validate_nonce": {"key": "validateNonce", "type": "bool"}, + "nonce_expiration_interval": {"key": "nonceExpirationInterval", "type": "str"}, } - def __init__( # pylint: disable=too-many-locals + def __init__( + self, *, validate_nonce: Optional[bool] = None, nonce_expiration_interval: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword validate_nonce: :code:`false` if the nonce should not be validated while + completing the login flow; otherwise, :code:`true`. + :paramtype validate_nonce: bool + :keyword nonce_expiration_interval: The time after the request is made when the nonce should + expire. + :paramtype nonce_expiration_interval: str + """ + super().__init__(**kwargs) + self.validate_nonce = validate_nonce + self.nonce_expiration_interval = nonce_expiration_interval + + +class OpenIdConnectClientCredential(_serialization.Model): + """The authentication client credentials of the custom Open ID Connect provider. + + :ivar method: The method that should be used to authenticate the user. Default value is + "ClientSecretPost". + :vartype method: str + :ivar client_secret_setting_name: The app setting that contains the client secret for the + custom Open ID Connect provider. + :vartype client_secret_setting_name: str + """ + + _attribute_map = { + "method": {"key": "method", "type": "str"}, + "client_secret_setting_name": {"key": "clientSecretSettingName", "type": "str"}, + } + + def __init__( self, *, - location: str, - tags: Optional[Dict[str, str]] = None, - kind: Optional[str] = None, - identity: Optional["_models.ManagedServiceIdentity"] = None, - dapr_ai_instrumentation_key: Optional[str] = None, - dapr_ai_connection_string: Optional[str] = None, - vnet_configuration: Optional["_models.VnetConfiguration"] = None, - app_logs_configuration: Optional["_models.AppLogsConfiguration"] = None, - zone_redundant: Optional[bool] = None, - custom_domain_configuration: Optional["_models.CustomDomainConfiguration"] = None, - workload_profiles: Optional[List["_models.WorkloadProfile"]] = None, - keda_configuration: Optional["_models.KedaConfiguration"] = None, - dapr_configuration: Optional["_models.DaprConfiguration"] = None, - infrastructure_resource_group: Optional[str] = None, - peer_authentication: Optional["_models.ManagedEnvironmentPropertiesPeerAuthentication"] = None, - peer_traffic_configuration: Optional["_models.ManagedEnvironmentPropertiesPeerTrafficConfiguration"] = None, + method: Optional[Literal["ClientSecretPost"]] = None, + client_secret_setting_name: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - :keyword kind: Kind of the Environment. - :paramtype kind: str - :keyword identity: Managed identities for the Managed Environment to interact with other Azure - services without maintaining any secrets or credentials in code. - :paramtype identity: ~azure.mgmt.appcontainers.models.ManagedServiceIdentity - :keyword dapr_ai_instrumentation_key: Azure Monitor instrumentation key used by Dapr to export - Service to Service communication telemetry. - :paramtype dapr_ai_instrumentation_key: str - :keyword dapr_ai_connection_string: Application Insights connection string used by Dapr to - export Service to Service communication telemetry. - :paramtype dapr_ai_connection_string: str - :keyword vnet_configuration: Vnet configuration for the environment. - :paramtype vnet_configuration: ~azure.mgmt.appcontainers.models.VnetConfiguration - :keyword app_logs_configuration: Cluster configuration which enables the log daemon to export - app logs to configured destination. - :paramtype app_logs_configuration: ~azure.mgmt.appcontainers.models.AppLogsConfiguration - :keyword zone_redundant: Whether or not this Managed Environment is zone-redundant. - :paramtype zone_redundant: bool - :keyword custom_domain_configuration: Custom domain configuration for the environment. - :paramtype custom_domain_configuration: - ~azure.mgmt.appcontainers.models.CustomDomainConfiguration - :keyword workload_profiles: Workload profiles configured for the Managed Environment. - :paramtype workload_profiles: list[~azure.mgmt.appcontainers.models.WorkloadProfile] - :keyword keda_configuration: The configuration of Keda component. - :paramtype keda_configuration: ~azure.mgmt.appcontainers.models.KedaConfiguration - :keyword dapr_configuration: The configuration of Dapr component. - :paramtype dapr_configuration: ~azure.mgmt.appcontainers.models.DaprConfiguration - :keyword infrastructure_resource_group: Name of the platform-managed resource group created for - the Managed Environment to host infrastructure resources. If a subnet ID is provided, this - resource group will be created in the same subscription as the subnet. - :paramtype infrastructure_resource_group: str - :keyword peer_authentication: Peer authentication settings for the Managed Environment. - :paramtype peer_authentication: - ~azure.mgmt.appcontainers.models.ManagedEnvironmentPropertiesPeerAuthentication - :keyword peer_traffic_configuration: Peer traffic settings for the Managed Environment. - :paramtype peer_traffic_configuration: - ~azure.mgmt.appcontainers.models.ManagedEnvironmentPropertiesPeerTrafficConfiguration + :keyword method: The method that should be used to authenticate the user. Default value is + "ClientSecretPost". + :paramtype method: str + :keyword client_secret_setting_name: The app setting that contains the client secret for the + custom Open ID Connect provider. + :paramtype client_secret_setting_name: str """ - super().__init__(tags=tags, location=location, **kwargs) - self.kind = kind - self.identity = identity - self.provisioning_state = None - self.dapr_ai_instrumentation_key = dapr_ai_instrumentation_key - self.dapr_ai_connection_string = dapr_ai_connection_string - self.vnet_configuration = vnet_configuration - self.deployment_errors = None - self.default_domain = None - self.static_ip = None - self.app_logs_configuration = app_logs_configuration - self.zone_redundant = zone_redundant - self.custom_domain_configuration = custom_domain_configuration - self.event_stream_endpoint = None - self.workload_profiles = workload_profiles - self.keda_configuration = keda_configuration - self.dapr_configuration = dapr_configuration - self.infrastructure_resource_group = infrastructure_resource_group - self.peer_authentication = peer_authentication - self.peer_traffic_configuration = peer_traffic_configuration + super().__init__(**kwargs) + self.method = method + self.client_secret_setting_name = client_secret_setting_name -class ManagedEnvironmentPropertiesPeerAuthentication(_serialization.Model): # pylint: disable=name-too-long - """Peer authentication settings for the Managed Environment. +class OpenIdConnectConfig(_serialization.Model): + """The configuration settings of the endpoints used for the custom Open ID Connect provider. - :ivar mtls: Mutual TLS authentication settings for the Managed Environment. - :vartype mtls: ~azure.mgmt.appcontainers.models.Mtls + :ivar authorization_endpoint: The endpoint to be used to make an authorization request. + :vartype authorization_endpoint: str + :ivar token_endpoint: The endpoint to be used to request a token. + :vartype token_endpoint: str + :ivar issuer: The endpoint that issues the token. + :vartype issuer: str + :ivar certification_uri: The endpoint that provides the keys necessary to validate the token. + :vartype certification_uri: str + :ivar well_known_open_id_configuration: The endpoint that contains all the configuration + endpoints for the provider. + :vartype well_known_open_id_configuration: str """ _attribute_map = { - "mtls": {"key": "mtls", "type": "Mtls"}, + "authorization_endpoint": {"key": "authorizationEndpoint", "type": "str"}, + "token_endpoint": {"key": "tokenEndpoint", "type": "str"}, + "issuer": {"key": "issuer", "type": "str"}, + "certification_uri": {"key": "certificationUri", "type": "str"}, + "well_known_open_id_configuration": {"key": "wellKnownOpenIdConfiguration", "type": "str"}, } - def __init__(self, *, mtls: Optional["_models.Mtls"] = None, **kwargs: Any) -> None: + def __init__( + self, + *, + authorization_endpoint: Optional[str] = None, + token_endpoint: Optional[str] = None, + issuer: Optional[str] = None, + certification_uri: Optional[str] = None, + well_known_open_id_configuration: Optional[str] = None, + **kwargs: Any + ) -> None: """ - :keyword mtls: Mutual TLS authentication settings for the Managed Environment. - :paramtype mtls: ~azure.mgmt.appcontainers.models.Mtls + :keyword authorization_endpoint: The endpoint to be used to make an authorization request. + :paramtype authorization_endpoint: str + :keyword token_endpoint: The endpoint to be used to request a token. + :paramtype token_endpoint: str + :keyword issuer: The endpoint that issues the token. + :paramtype issuer: str + :keyword certification_uri: The endpoint that provides the keys necessary to validate the + token. + :paramtype certification_uri: str + :keyword well_known_open_id_configuration: The endpoint that contains all the configuration + endpoints for the provider. + :paramtype well_known_open_id_configuration: str """ super().__init__(**kwargs) - self.mtls = mtls + self.authorization_endpoint = authorization_endpoint + self.token_endpoint = token_endpoint + self.issuer = issuer + self.certification_uri = certification_uri + self.well_known_open_id_configuration = well_known_open_id_configuration -class ManagedEnvironmentPropertiesPeerTrafficConfiguration(_serialization.Model): # pylint: disable=name-too-long - """Peer traffic settings for the Managed Environment. +class OpenIdConnectLogin(_serialization.Model): + """The configuration settings of the login flow of the custom Open ID Connect provider. - :ivar encryption: Peer traffic encryption settings for the Managed Environment. - :vartype encryption: - ~azure.mgmt.appcontainers.models.ManagedEnvironmentPropertiesPeerTrafficConfigurationEncryption + :ivar name_claim_type: The name of the claim that contains the users name. + :vartype name_claim_type: str + :ivar scopes: A list of the scopes that should be requested while authenticating. + :vartype scopes: list[str] """ _attribute_map = { - "encryption": {"key": "encryption", "type": "ManagedEnvironmentPropertiesPeerTrafficConfigurationEncryption"}, + "name_claim_type": {"key": "nameClaimType", "type": "str"}, + "scopes": {"key": "scopes", "type": "[str]"}, } def __init__( - self, - *, - encryption: Optional["_models.ManagedEnvironmentPropertiesPeerTrafficConfigurationEncryption"] = None, - **kwargs: Any + self, *, name_claim_type: Optional[str] = None, scopes: Optional[List[str]] = None, **kwargs: Any ) -> None: """ - :keyword encryption: Peer traffic encryption settings for the Managed Environment. - :paramtype encryption: - ~azure.mgmt.appcontainers.models.ManagedEnvironmentPropertiesPeerTrafficConfigurationEncryption + :keyword name_claim_type: The name of the claim that contains the users name. + :paramtype name_claim_type: str + :keyword scopes: A list of the scopes that should be requested while authenticating. + :paramtype scopes: list[str] """ super().__init__(**kwargs) - self.encryption = encryption + self.name_claim_type = name_claim_type + self.scopes = scopes -class ManagedEnvironmentPropertiesPeerTrafficConfigurationEncryption( - _serialization.Model -): # pylint: disable=name-too-long - """Peer traffic encryption settings for the Managed Environment. +class OpenIdConnectRegistration(_serialization.Model): + """The configuration settings of the app registration for the custom Open ID Connect provider. - :ivar enabled: Boolean indicating whether the peer traffic encryption is enabled. - :vartype enabled: bool + :ivar client_id: The client id of the custom Open ID Connect provider. + :vartype client_id: str + :ivar client_credential: The authentication credentials of the custom Open ID Connect provider. + :vartype client_credential: ~azure.mgmt.appcontainers.models.OpenIdConnectClientCredential + :ivar open_id_connect_configuration: The configuration settings of the endpoints used for the + custom Open ID Connect provider. + :vartype open_id_connect_configuration: ~azure.mgmt.appcontainers.models.OpenIdConnectConfig """ _attribute_map = { - "enabled": {"key": "enabled", "type": "bool"}, + "client_id": {"key": "clientId", "type": "str"}, + "client_credential": {"key": "clientCredential", "type": "OpenIdConnectClientCredential"}, + "open_id_connect_configuration": {"key": "openIdConnectConfiguration", "type": "OpenIdConnectConfig"}, } - def __init__(self, *, enabled: Optional[bool] = None, **kwargs: Any) -> None: + def __init__( + self, + *, + client_id: Optional[str] = None, + client_credential: Optional["_models.OpenIdConnectClientCredential"] = None, + open_id_connect_configuration: Optional["_models.OpenIdConnectConfig"] = None, + **kwargs: Any + ) -> None: """ - :keyword enabled: Boolean indicating whether the peer traffic encryption is enabled. - :paramtype enabled: bool + :keyword client_id: The client id of the custom Open ID Connect provider. + :paramtype client_id: str + :keyword client_credential: The authentication credentials of the custom Open ID Connect + provider. + :paramtype client_credential: ~azure.mgmt.appcontainers.models.OpenIdConnectClientCredential + :keyword open_id_connect_configuration: The configuration settings of the endpoints used for + the custom Open ID Connect provider. + :paramtype open_id_connect_configuration: ~azure.mgmt.appcontainers.models.OpenIdConnectConfig """ super().__init__(**kwargs) - self.enabled = enabled - - -class ManagedEnvironmentsCollection(_serialization.Model): - """Collection of Environments. + self.client_id = client_id + self.client_credential = client_credential + self.open_id_connect_configuration = open_id_connect_configuration - Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to server. +class OpenTelemetryConfiguration(_serialization.Model): + """Configuration of Open Telemetry. - :ivar value: Collection of resources. Required. - :vartype value: list[~azure.mgmt.appcontainers.models.ManagedEnvironment] - :ivar next_link: Link to next page of resources. - :vartype next_link: str + :ivar destinations_configuration: Open telemetry destinations configuration. + :vartype destinations_configuration: ~azure.mgmt.appcontainers.models.DestinationsConfiguration + :ivar traces_configuration: Open telemetry trace configuration. + :vartype traces_configuration: ~azure.mgmt.appcontainers.models.TracesConfiguration + :ivar logs_configuration: Open telemetry logs configuration. + :vartype logs_configuration: ~azure.mgmt.appcontainers.models.LogsConfiguration + :ivar metrics_configuration: Open telemetry metrics configuration. + :vartype metrics_configuration: ~azure.mgmt.appcontainers.models.MetricsConfiguration """ - _validation = { - "value": {"required": True}, - "next_link": {"readonly": True}, - } - _attribute_map = { - "value": {"key": "value", "type": "[ManagedEnvironment]"}, - "next_link": {"key": "nextLink", "type": "str"}, + "destinations_configuration": {"key": "destinationsConfiguration", "type": "DestinationsConfiguration"}, + "traces_configuration": {"key": "tracesConfiguration", "type": "TracesConfiguration"}, + "logs_configuration": {"key": "logsConfiguration", "type": "LogsConfiguration"}, + "metrics_configuration": {"key": "metricsConfiguration", "type": "MetricsConfiguration"}, } - def __init__(self, *, value: List["_models.ManagedEnvironment"], **kwargs: Any) -> None: + def __init__( + self, + *, + destinations_configuration: Optional["_models.DestinationsConfiguration"] = None, + traces_configuration: Optional["_models.TracesConfiguration"] = None, + logs_configuration: Optional["_models.LogsConfiguration"] = None, + metrics_configuration: Optional["_models.MetricsConfiguration"] = None, + **kwargs: Any + ) -> None: """ - :keyword value: Collection of resources. Required. - :paramtype value: list[~azure.mgmt.appcontainers.models.ManagedEnvironment] + :keyword destinations_configuration: Open telemetry destinations configuration. + :paramtype destinations_configuration: + ~azure.mgmt.appcontainers.models.DestinationsConfiguration + :keyword traces_configuration: Open telemetry trace configuration. + :paramtype traces_configuration: ~azure.mgmt.appcontainers.models.TracesConfiguration + :keyword logs_configuration: Open telemetry logs configuration. + :paramtype logs_configuration: ~azure.mgmt.appcontainers.models.LogsConfiguration + :keyword metrics_configuration: Open telemetry metrics configuration. + :paramtype metrics_configuration: ~azure.mgmt.appcontainers.models.MetricsConfiguration """ super().__init__(**kwargs) - self.value = value - self.next_link = None - + self.destinations_configuration = destinations_configuration + self.traces_configuration = traces_configuration + self.logs_configuration = logs_configuration + self.metrics_configuration = metrics_configuration -class ManagedEnvironmentStorage(ProxyResource): - """Storage resource for managedEnvironment. - Variables are only populated by the server, and will be ignored when sending a request. +class OperationDetail(_serialization.Model): + """Operation detail payload. - :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. + :ivar name: Name of the operation. :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData - :ivar properties: Storage properties. - :vartype properties: ~azure.mgmt.appcontainers.models.ManagedEnvironmentStorageProperties + :ivar is_data_action: Indicates whether the operation is a data action. + :vartype is_data_action: bool + :ivar display: Display of the operation. + :vartype display: ~azure.mgmt.appcontainers.models.OperationDisplay + :ivar origin: Origin of the operation. + :vartype origin: str """ - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - } - _attribute_map = { - "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "properties": {"key": "properties", "type": "ManagedEnvironmentStorageProperties"}, + "is_data_action": {"key": "isDataAction", "type": "bool"}, + "display": {"key": "display", "type": "OperationDisplay"}, + "origin": {"key": "origin", "type": "str"}, } def __init__( - self, *, properties: Optional["_models.ManagedEnvironmentStorageProperties"] = None, **kwargs: Any + self, + *, + name: Optional[str] = None, + is_data_action: Optional[bool] = None, + display: Optional["_models.OperationDisplay"] = None, + origin: Optional[str] = None, + **kwargs: Any ) -> None: """ - :keyword properties: Storage properties. - :paramtype properties: ~azure.mgmt.appcontainers.models.ManagedEnvironmentStorageProperties + :keyword name: Name of the operation. + :paramtype name: str + :keyword is_data_action: Indicates whether the operation is a data action. + :paramtype is_data_action: bool + :keyword display: Display of the operation. + :paramtype display: ~azure.mgmt.appcontainers.models.OperationDisplay + :keyword origin: Origin of the operation. + :paramtype origin: str """ super().__init__(**kwargs) - self.properties = properties + self.name = name + self.is_data_action = is_data_action + self.display = display + self.origin = origin -class ManagedEnvironmentStorageProperties(_serialization.Model): - """Storage properties. +class OperationDisplay(_serialization.Model): + """Operation display payload. - :ivar azure_file: Azure file properties. - :vartype azure_file: ~azure.mgmt.appcontainers.models.AzureFileProperties - :ivar nfs_azure_file: NFS Azure file properties. - :vartype nfs_azure_file: ~azure.mgmt.appcontainers.models.NfsAzureFileProperties + :ivar provider: Resource provider of the operation. + :vartype provider: str + :ivar resource: Resource of the operation. + :vartype resource: str + :ivar operation: Localized friendly name for the operation. + :vartype operation: str + :ivar description: Localized friendly description for the operation. + :vartype description: str """ _attribute_map = { - "azure_file": {"key": "azureFile", "type": "AzureFileProperties"}, - "nfs_azure_file": {"key": "nfsAzureFile", "type": "NfsAzureFileProperties"}, + "provider": {"key": "provider", "type": "str"}, + "resource": {"key": "resource", "type": "str"}, + "operation": {"key": "operation", "type": "str"}, + "description": {"key": "description", "type": "str"}, } def __init__( self, *, - azure_file: Optional["_models.AzureFileProperties"] = None, - nfs_azure_file: Optional["_models.NfsAzureFileProperties"] = None, + provider: Optional[str] = None, + resource: Optional[str] = None, + operation: Optional[str] = None, + description: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword azure_file: Azure file properties. - :paramtype azure_file: ~azure.mgmt.appcontainers.models.AzureFileProperties - :keyword nfs_azure_file: NFS Azure file properties. - :paramtype nfs_azure_file: ~azure.mgmt.appcontainers.models.NfsAzureFileProperties + :keyword provider: Resource provider of the operation. + :paramtype provider: str + :keyword resource: Resource of the operation. + :paramtype resource: str + :keyword operation: Localized friendly name for the operation. + :paramtype operation: str + :keyword description: Localized friendly description for the operation. + :paramtype description: str """ super().__init__(**kwargs) - self.azure_file = azure_file - self.nfs_azure_file = nfs_azure_file - + self.provider = provider + self.resource = resource + self.operation = operation + self.description = description -class ManagedEnvironmentStoragesCollection(_serialization.Model): - """Collection of Storage for Environments. - All required parameters must be populated in order to send to server. +class OtlpConfiguration(_serialization.Model): + """Configuration of otlp. - :ivar value: Collection of storage resources. Required. - :vartype value: list[~azure.mgmt.appcontainers.models.ManagedEnvironmentStorage] + :ivar name: The name of otlp configuration. + :vartype name: str + :ivar endpoint: The endpoint of otlp configuration. + :vartype endpoint: str + :ivar insecure: Boolean indicating if otlp configuration is insecure. + :vartype insecure: bool + :ivar headers: Headers of otlp configurations. + :vartype headers: list[~azure.mgmt.appcontainers.models.Header] """ - _validation = { - "value": {"required": True}, - } - _attribute_map = { - "value": {"key": "value", "type": "[ManagedEnvironmentStorage]"}, + "name": {"key": "name", "type": "str"}, + "endpoint": {"key": "endpoint", "type": "str"}, + "insecure": {"key": "insecure", "type": "bool"}, + "headers": {"key": "headers", "type": "[Header]"}, } - def __init__(self, *, value: List["_models.ManagedEnvironmentStorage"], **kwargs: Any) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + endpoint: Optional[str] = None, + insecure: Optional[bool] = None, + headers: Optional[List["_models.Header"]] = None, + **kwargs: Any + ) -> None: """ - :keyword value: Collection of storage resources. Required. - :paramtype value: list[~azure.mgmt.appcontainers.models.ManagedEnvironmentStorage] + :keyword name: The name of otlp configuration. + :paramtype name: str + :keyword endpoint: The endpoint of otlp configuration. + :paramtype endpoint: str + :keyword insecure: Boolean indicating if otlp configuration is insecure. + :paramtype insecure: bool + :keyword headers: Headers of otlp configurations. + :paramtype headers: list[~azure.mgmt.appcontainers.models.Header] """ super().__init__(**kwargs) - self.value = value + self.name = name + self.endpoint = endpoint + self.insecure = insecure + self.headers = headers -class ManagedIdentitySetting(_serialization.Model): - """Optional settings for a Managed Identity that is assigned to the Session pool. +class PatchCollection(_serialization.Model): + """Container App patch collection. All required parameters must be populated in order to send to server. - :ivar identity: The resource ID of a user-assigned managed identity that is assigned to the - Session Pool, or 'system' for system-assigned identity. Required. - :vartype identity: str - :ivar lifecycle: Use to select the lifecycle stages of a Session Pool during which the Managed - Identity should be available. Known values are: "Init", "Main", "None", and "All". - :vartype lifecycle: str or ~azure.mgmt.appcontainers.models.IdentitySettingsLifeCycle + :ivar value: Collection of patch resources. Required. + :vartype value: list[~azure.mgmt.appcontainers.models.ContainerAppsPatchResource] + :ivar next_link: the link to the next page of items. + :vartype next_link: str """ _validation = { - "identity": {"required": True}, + "value": {"required": True}, } _attribute_map = { - "identity": {"key": "identity", "type": "str"}, - "lifecycle": {"key": "lifecycle", "type": "str"}, + "value": {"key": "value", "type": "[ContainerAppsPatchResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( - self, - *, - identity: str, - lifecycle: Optional[Union[str, "_models.IdentitySettingsLifeCycle"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword identity: The resource ID of a user-assigned managed identity that is assigned to the - Session Pool, or 'system' for system-assigned identity. Required. - :paramtype identity: str - :keyword lifecycle: Use to select the lifecycle stages of a Session Pool during which the - Managed Identity should be available. Known values are: "Init", "Main", "None", and "All". - :paramtype lifecycle: str or ~azure.mgmt.appcontainers.models.IdentitySettingsLifeCycle + self, *, value: List["_models.ContainerAppsPatchResource"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: Collection of patch resources. Required. + :paramtype value: list[~azure.mgmt.appcontainers.models.ContainerAppsPatchResource] + :keyword next_link: the link to the next page of items. + :paramtype next_link: str """ super().__init__(**kwargs) - self.identity = identity - self.lifecycle = lifecycle + self.value = value + self.next_link = next_link -class ManagedServiceIdentity(_serialization.Model): - """Managed service identity (system assigned and/or user assigned identities). +class PatchDetails(_serialization.Model): + """The detailed info of patch operation performing when applying a patch. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to server. - :ivar principal_id: The service principal ID of the system assigned identity. This property - will only be provided for a system assigned identity. - :vartype principal_id: str - :ivar tenant_id: The tenant ID of the system assigned identity. This property will only be - provided for a system assigned identity. - :vartype tenant_id: str - :ivar type: Type of managed service identity (where both SystemAssigned and UserAssigned types - are allowed). Required. Known values are: "None", "SystemAssigned", "UserAssigned", and - "SystemAssigned,UserAssigned". - :vartype type: str or ~azure.mgmt.appcontainers.models.ManagedServiceIdentityType - :ivar user_assigned_identities: The set of user assigned identities associated with the - resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. # pylint: disable=line-too-long - The dictionary values can be empty objects ({}) in requests. - :vartype user_assigned_identities: dict[str, - ~azure.mgmt.appcontainers.models.UserAssignedIdentity] + :ivar target_container_name: The name of the target container for the patch. Required. + :vartype target_container_name: str + :ivar target_image: The name of the target image for the patch. Required. + :vartype target_image: str + :ivar last_detection_time: The UTC timestamp that describes the latest detection was done. + Required. + :vartype last_detection_time: ~datetime.datetime + :ivar detection_status: The status of the patch detection. Required. Known values are: + "Succeeded", "RegistryLoginFailed", and "Failed". + :vartype detection_status: str or ~azure.mgmt.appcontainers.models.DetectionStatus + :ivar new_image_name: The name of the new image created by the patch. + :vartype new_image_name: str + :ivar new_layer: New layer update details in the target image. + :vartype new_layer: ~azure.mgmt.appcontainers.models.PatchDetailsNewLayer + :ivar old_layer: The old layer details in the target image. + :vartype old_layer: ~azure.mgmt.appcontainers.models.PatchDetailsOldLayer + :ivar patch_type: The type for the patch. Known values are: "FrameworkSecurity", "OSSecurity", + "FrameworkAndOSSecurity", and "Other". + :vartype patch_type: str or ~azure.mgmt.appcontainers.models.PatchType """ _validation = { - "principal_id": {"readonly": True}, - "tenant_id": {"readonly": True}, - "type": {"required": True}, + "target_container_name": {"required": True, "readonly": True}, + "target_image": {"required": True, "readonly": True}, + "last_detection_time": {"required": True, "readonly": True}, + "detection_status": {"required": True, "readonly": True}, + "new_image_name": {"readonly": True}, + "new_layer": {"readonly": True}, + "old_layer": {"readonly": True}, + "patch_type": {"readonly": True}, } _attribute_map = { - "principal_id": {"key": "principalId", "type": "str"}, - "tenant_id": {"key": "tenantId", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "user_assigned_identities": {"key": "userAssignedIdentities", "type": "{UserAssignedIdentity}"}, + "target_container_name": {"key": "targetContainerName", "type": "str"}, + "target_image": {"key": "targetImage", "type": "str"}, + "last_detection_time": {"key": "lastDetectionTime", "type": "iso-8601"}, + "detection_status": {"key": "detectionStatus", "type": "str"}, + "new_image_name": {"key": "newImageName", "type": "str"}, + "new_layer": {"key": "newLayer", "type": "PatchDetailsNewLayer"}, + "old_layer": {"key": "oldLayer", "type": "PatchDetailsOldLayer"}, + "patch_type": {"key": "patchType", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.target_container_name: Optional[str] = None + self.target_image: Optional[str] = None + self.last_detection_time: Optional[datetime.datetime] = None + self.detection_status: Optional[Union[str, "_models.DetectionStatus"]] = None + self.new_image_name: Optional[str] = None + self.new_layer: Optional["_models.PatchDetailsNewLayer"] = None + self.old_layer: Optional["_models.PatchDetailsOldLayer"] = None + self.patch_type: Optional[Union[str, "_models.PatchType"]] = None + + +class PatchDetailsNewLayer(_serialization.Model): + """New layer update details in the target image. + + :ivar name: The details of the new layer for the target image. + :vartype name: str + :ivar framework_and_version: The framework and its version in the new run image for the target + image. + :vartype framework_and_version: str + :ivar os_and_version: The OS name and its version in the new run image for the target image. + :vartype os_and_version: str + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "framework_and_version": {"key": "frameworkAndVersion", "type": "str"}, + "os_and_version": {"key": "osAndVersion", "type": "str"}, } def __init__( self, *, - type: Union[str, "_models.ManagedServiceIdentityType"], - user_assigned_identities: Optional[Dict[str, "_models.UserAssignedIdentity"]] = None, + name: Optional[str] = None, + framework_and_version: Optional[str] = None, + os_and_version: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword type: Type of managed service identity (where both SystemAssigned and UserAssigned - types are allowed). Required. Known values are: "None", "SystemAssigned", "UserAssigned", and - "SystemAssigned,UserAssigned". - :paramtype type: str or ~azure.mgmt.appcontainers.models.ManagedServiceIdentityType - :keyword user_assigned_identities: The set of user assigned identities associated with the - resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. # pylint: disable=line-too-long - The dictionary values can be empty objects ({}) in requests. - :paramtype user_assigned_identities: dict[str, - ~azure.mgmt.appcontainers.models.UserAssignedIdentity] + :keyword name: The details of the new layer for the target image. + :paramtype name: str + :keyword framework_and_version: The framework and its version in the new run image for the + target image. + :paramtype framework_and_version: str + :keyword os_and_version: The OS name and its version in the new run image for the target image. + :paramtype os_and_version: str """ super().__init__(**kwargs) - self.principal_id = None - self.tenant_id = None - self.type = type - self.user_assigned_identities = user_assigned_identities + self.name = name + self.framework_and_version = framework_and_version + self.os_and_version = os_and_version -class Mtls(_serialization.Model): - """Configuration properties for mutual TLS authentication. +class PatchDetailsOldLayer(_serialization.Model): + """The old layer details in the target image. - :ivar enabled: Boolean indicating whether the mutual TLS authentication is enabled. - :vartype enabled: bool + :ivar name: The details of the old layer for the target image. + :vartype name: str + :ivar framework_and_version: The framework and its version in the old run image for the target + image. + :vartype framework_and_version: str + :ivar os_and_version: The OS name and its version in the old run image for the target image. + :vartype os_and_version: str """ _attribute_map = { - "enabled": {"key": "enabled", "type": "bool"}, + "name": {"key": "name", "type": "str"}, + "framework_and_version": {"key": "frameworkAndVersion", "type": "str"}, + "os_and_version": {"key": "osAndVersion", "type": "str"}, } - def __init__(self, *, enabled: Optional[bool] = None, **kwargs: Any) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + framework_and_version: Optional[str] = None, + os_and_version: Optional[str] = None, + **kwargs: Any + ) -> None: """ - :keyword enabled: Boolean indicating whether the mutual TLS authentication is enabled. - :paramtype enabled: bool + :keyword name: The details of the old layer for the target image. + :paramtype name: str + :keyword framework_and_version: The framework and its version in the old run image for the + target image. + :paramtype framework_and_version: str + :keyword os_and_version: The OS name and its version in the old run image for the target image. + :paramtype os_and_version: str """ super().__init__(**kwargs) - self.enabled = enabled + self.name = name + self.framework_and_version = framework_and_version + self.os_and_version = os_and_version -class NfsAzureFileProperties(_serialization.Model): - """NFS Azure File Properties. +class PatchProperties(_serialization.Model): + """Top level properties that describes current states of the patch resource. - :ivar server: Server for NFS azure file. Specify the Azure storage account server address. - :vartype server: str - :ivar access_mode: Access mode for storage. Known values are: "ReadOnly" and "ReadWrite". - :vartype access_mode: str or ~azure.mgmt.appcontainers.models.AccessMode - :ivar share_name: NFS Azure file share name. - :vartype share_name: str + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar target_environment_id: The Azure resource id of the target environment for the patch. + :vartype target_environment_id: str + :ivar target_container_app_id: The Azure resource id of the target container app for the patch. + :vartype target_container_app_id: str + :ivar target_revision_id: The Azure resource id of the target revision for the patch. + :vartype target_revision_id: str + :ivar patch_apply_status: The status of the patch operation. Known values are: "NotStarted", + "RebaseInProgress", "CreatingRevision", "Succeeded", "Canceled", "RebaseFailed", + "RevisionCreationFailed", "ImagePushPullFailed", and "ManuallySkipped". + :vartype patch_apply_status: str or ~azure.mgmt.appcontainers.models.PatchApplyStatus + :ivar created_at: The UTC timestamp that describes when the patch object was created. + :vartype created_at: ~datetime.datetime + :ivar last_modified_at: The UTC timestamp that describes when the patch object was last + updated. + :vartype last_modified_at: ~datetime.datetime + :ivar patch_details: Detailed info describes the patch operation for the target container app. + :vartype patch_details: list[~azure.mgmt.appcontainers.models.PatchDetails] """ + _validation = { + "patch_apply_status": {"readonly": True}, + "created_at": {"readonly": True}, + "last_modified_at": {"readonly": True}, + "patch_details": {"readonly": True}, + } + _attribute_map = { - "server": {"key": "server", "type": "str"}, - "access_mode": {"key": "accessMode", "type": "str"}, - "share_name": {"key": "shareName", "type": "str"}, + "target_environment_id": {"key": "targetEnvironmentId", "type": "str"}, + "target_container_app_id": {"key": "targetContainerAppId", "type": "str"}, + "target_revision_id": {"key": "targetRevisionId", "type": "str"}, + "patch_apply_status": {"key": "patchApplyStatus", "type": "str"}, + "created_at": {"key": "createdAt", "type": "iso-8601"}, + "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, + "patch_details": {"key": "patchDetails", "type": "[PatchDetails]"}, } def __init__( self, *, - server: Optional[str] = None, - access_mode: Optional[Union[str, "_models.AccessMode"]] = None, - share_name: Optional[str] = None, + target_environment_id: Optional[str] = None, + target_container_app_id: Optional[str] = None, + target_revision_id: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword server: Server for NFS azure file. Specify the Azure storage account server address. - :paramtype server: str - :keyword access_mode: Access mode for storage. Known values are: "ReadOnly" and "ReadWrite". - :paramtype access_mode: str or ~azure.mgmt.appcontainers.models.AccessMode - :keyword share_name: NFS Azure file share name. - :paramtype share_name: str + :keyword target_environment_id: The Azure resource id of the target environment for the patch. + :paramtype target_environment_id: str + :keyword target_container_app_id: The Azure resource id of the target container app for the + patch. + :paramtype target_container_app_id: str + :keyword target_revision_id: The Azure resource id of the target revision for the patch. + :paramtype target_revision_id: str """ super().__init__(**kwargs) - self.server = server - self.access_mode = access_mode - self.share_name = share_name + self.target_environment_id = target_environment_id + self.target_container_app_id = target_container_app_id + self.target_revision_id = target_revision_id + self.patch_apply_status: Optional[Union[str, "_models.PatchApplyStatus"]] = None + self.created_at: Optional[datetime.datetime] = None + self.last_modified_at: Optional[datetime.datetime] = None + self.patch_details: Optional[List["_models.PatchDetails"]] = None -class Nonce(_serialization.Model): - """The configuration settings of the nonce used in the login flow. +class PatchSkipConfig(_serialization.Model): + """The configuration for patcher to skip a patch or not. - :ivar validate_nonce: :code:`false` if the nonce should not be validated while - completing the login flow; otherwise, :code:`true`. - :vartype validate_nonce: bool - :ivar nonce_expiration_interval: The time after the request is made when the nonce should - expire. - :vartype nonce_expiration_interval: str + :ivar skip: The flag to indicate whether to skip the patch or not. + :vartype skip: bool """ _attribute_map = { - "validate_nonce": {"key": "validateNonce", "type": "bool"}, - "nonce_expiration_interval": {"key": "nonceExpirationInterval", "type": "str"}, + "skip": {"key": "skip", "type": "bool"}, } - def __init__( - self, *, validate_nonce: Optional[bool] = None, nonce_expiration_interval: Optional[str] = None, **kwargs: Any - ) -> None: + def __init__(self, *, skip: Optional[bool] = None, **kwargs: Any) -> None: """ - :keyword validate_nonce: :code:`false` if the nonce should not be validated while - completing the login flow; otherwise, :code:`true`. - :paramtype validate_nonce: bool - :keyword nonce_expiration_interval: The time after the request is made when the nonce should - expire. - :paramtype nonce_expiration_interval: str + :keyword skip: The flag to indicate whether to skip the patch or not. + :paramtype skip: bool """ super().__init__(**kwargs) - self.validate_nonce = validate_nonce - self.nonce_expiration_interval = nonce_expiration_interval + self.skip = skip -class OpenIdConnectClientCredential(_serialization.Model): - """The authentication client credentials of the custom Open ID Connect provider. +class PreBuildStep(_serialization.Model): + """Model representing a pre-build step. - :ivar method: The method that should be used to authenticate the user. Default value is - "ClientSecretPost". - :vartype method: str - :ivar client_secret_setting_name: The app setting that contains the client secret for the - custom Open ID Connect provider. - :vartype client_secret_setting_name: str + :ivar 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 = { - "method": {"key": "method", "type": "str"}, - "client_secret_setting_name": {"key": "clientSecretSettingName", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "scripts": {"key": "scripts", "type": "[str]"}, + "http_get": {"key": "httpGet", "type": "HttpGet"}, } def __init__( self, *, - method: Optional[Literal["ClientSecretPost"]] = None, - client_secret_setting_name: Optional[str] = None, + description: Optional[str] = None, + scripts: Optional[List[str]] = None, + http_get: Optional["_models.HttpGet"] = None, **kwargs: Any ) -> None: """ - :keyword method: The method that should be used to authenticate the user. Default value is - "ClientSecretPost". - :paramtype method: str - :keyword client_secret_setting_name: The app setting that contains the client secret for the - custom Open ID Connect provider. - :paramtype client_secret_setting_name: str + :keyword 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.method = method - self.client_secret_setting_name = client_secret_setting_name + self.description = description + self.scripts = scripts + self.http_get = http_get -class OpenIdConnectConfig(_serialization.Model): - """The configuration settings of the endpoints used for the custom Open ID Connect provider. +class PrivateEndpoint(_serialization.Model): + """The Private Endpoint resource. - :ivar authorization_endpoint: The endpoint to be used to make an authorization request. - :vartype authorization_endpoint: str - :ivar token_endpoint: The endpoint to be used to request a token. - :vartype token_endpoint: str - :ivar issuer: The endpoint that issues the token. - :vartype issuer: str - :ivar certification_uri: The endpoint that provides the keys necessary to validate the token. - :vartype certification_uri: str - :ivar well_known_open_id_configuration: The endpoint that contains all the configuration - endpoints for the provider. - :vartype well_known_open_id_configuration: str + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The ARM identifier for Private Endpoint. + :vartype id: str """ + _validation = { + "id": {"readonly": True}, + } + _attribute_map = { - "authorization_endpoint": {"key": "authorizationEndpoint", "type": "str"}, - "token_endpoint": {"key": "tokenEndpoint", "type": "str"}, - "issuer": {"key": "issuer", "type": "str"}, - "certification_uri": {"key": "certificationUri", "type": "str"}, - "well_known_open_id_configuration": {"key": "wellKnownOpenIdConfiguration", "type": "str"}, + "id": {"key": "id", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.id: Optional[str] = None + + +class PrivateEndpointConnection(Resource): + """The Private Endpoint Connection resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData + :ivar group_ids: The group ids for the private endpoint resource. + :vartype group_ids: list[str] + :ivar private_endpoint: The resource of private end point. + :vartype private_endpoint: ~azure.mgmt.appcontainers.models.PrivateEndpoint + :ivar private_link_service_connection_state: A collection of information about the state of the + connection between service consumer and provider. + :vartype private_link_service_connection_state: + ~azure.mgmt.appcontainers.models.PrivateLinkServiceConnectionState + :ivar provisioning_state: The provisioning state of the private endpoint connection resource. + Known values are: "Succeeded", "Failed", "Canceled", "Waiting", "Updating", "Deleting", and + "Pending". + :vartype provisioning_state: str or + ~azure.mgmt.appcontainers.models.PrivateEndpointConnectionProvisioningState + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "group_ids": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "group_ids": {"key": "properties.groupIds", "type": "[str]"}, + "private_endpoint": {"key": "properties.privateEndpoint", "type": "PrivateEndpoint"}, + "private_link_service_connection_state": { + "key": "properties.privateLinkServiceConnectionState", + "type": "PrivateLinkServiceConnectionState", + }, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, } def __init__( self, *, - authorization_endpoint: Optional[str] = None, - token_endpoint: Optional[str] = None, - issuer: Optional[str] = None, - certification_uri: Optional[str] = None, - well_known_open_id_configuration: Optional[str] = None, + private_endpoint: Optional["_models.PrivateEndpoint"] = None, + private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionState"] = None, **kwargs: Any ) -> None: """ - :keyword authorization_endpoint: The endpoint to be used to make an authorization request. - :paramtype authorization_endpoint: str - :keyword token_endpoint: The endpoint to be used to request a token. - :paramtype token_endpoint: str - :keyword issuer: The endpoint that issues the token. - :paramtype issuer: str - :keyword certification_uri: The endpoint that provides the keys necessary to validate the - token. - :paramtype certification_uri: str - :keyword well_known_open_id_configuration: The endpoint that contains all the configuration - endpoints for the provider. - :paramtype well_known_open_id_configuration: str + :keyword private_endpoint: The resource of private end point. + :paramtype private_endpoint: ~azure.mgmt.appcontainers.models.PrivateEndpoint + :keyword private_link_service_connection_state: A collection of information about the state of + the connection between service consumer and provider. + :paramtype private_link_service_connection_state: + ~azure.mgmt.appcontainers.models.PrivateLinkServiceConnectionState """ super().__init__(**kwargs) - self.authorization_endpoint = authorization_endpoint - self.token_endpoint = token_endpoint - self.issuer = issuer - self.certification_uri = certification_uri - self.well_known_open_id_configuration = well_known_open_id_configuration + self.group_ids: Optional[List[str]] = None + self.private_endpoint = private_endpoint + self.private_link_service_connection_state = private_link_service_connection_state + self.provisioning_state: Optional[Union[str, "_models.PrivateEndpointConnectionProvisioningState"]] = None -class OpenIdConnectLogin(_serialization.Model): - """The configuration settings of the login flow of the custom Open ID Connect provider. +class PrivateEndpointConnectionListResult(_serialization.Model): + """List of private endpoint connection associated with the specified resource. - :ivar name_claim_type: The name of the claim that contains the users name. - :vartype name_claim_type: str - :ivar scopes: A list of the scopes that should be requested while authenticating. - :vartype scopes: list[str] + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: Array of private endpoint connections. + :vartype value: list[~azure.mgmt.appcontainers.models.PrivateEndpointConnection] + :ivar next_link: URL to get the next set of operation list results (if there are any). + :vartype next_link: str """ + _validation = { + "next_link": {"readonly": True}, + } + _attribute_map = { - "name_claim_type": {"key": "nameClaimType", "type": "str"}, - "scopes": {"key": "scopes", "type": "[str]"}, + "value": {"key": "value", "type": "[PrivateEndpointConnection]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, *, name_claim_type: Optional[str] = None, scopes: Optional[List[str]] = None, **kwargs: Any - ) -> None: + def __init__(self, *, value: Optional[List["_models.PrivateEndpointConnection"]] = None, **kwargs: Any) -> None: """ - :keyword name_claim_type: The name of the claim that contains the users name. - :paramtype name_claim_type: str - :keyword scopes: A list of the scopes that should be requested while authenticating. - :paramtype scopes: list[str] + :keyword value: Array of private endpoint connections. + :paramtype value: list[~azure.mgmt.appcontainers.models.PrivateEndpointConnection] """ super().__init__(**kwargs) - self.name_claim_type = name_claim_type - self.scopes = scopes + self.value = value + self.next_link: Optional[str] = None -class OpenIdConnectRegistration(_serialization.Model): - """The configuration settings of the app registration for the custom Open ID Connect provider. +class PrivateLinkResource(Resource): + """A private link resource. - :ivar client_id: The client id of the custom Open ID Connect provider. - :vartype client_id: str - :ivar client_credential: The authentication credentials of the custom Open ID Connect provider. - :vartype client_credential: ~azure.mgmt.appcontainers.models.OpenIdConnectClientCredential - :ivar open_id_connect_configuration: The configuration settings of the endpoints used for the - custom Open ID Connect provider. - :vartype open_id_connect_configuration: ~azure.mgmt.appcontainers.models.OpenIdConnectConfig + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData + :ivar group_id: The private link resource group id. + :vartype group_id: str + :ivar required_members: The private link resource required member names. + :vartype required_members: list[str] + :ivar required_zone_names: The private link resource private link DNS zone name. + :vartype required_zone_names: list[str] """ + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "group_id": {"readonly": True}, + "required_members": {"readonly": True}, + } + _attribute_map = { - "client_id": {"key": "clientId", "type": "str"}, - "client_credential": {"key": "clientCredential", "type": "OpenIdConnectClientCredential"}, - "open_id_connect_configuration": {"key": "openIdConnectConfiguration", "type": "OpenIdConnectConfig"}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "group_id": {"key": "properties.groupId", "type": "str"}, + "required_members": {"key": "properties.requiredMembers", "type": "[str]"}, + "required_zone_names": {"key": "properties.requiredZoneNames", "type": "[str]"}, } - def __init__( - self, - *, - client_id: Optional[str] = None, - client_credential: Optional["_models.OpenIdConnectClientCredential"] = None, - open_id_connect_configuration: Optional["_models.OpenIdConnectConfig"] = None, - **kwargs: Any - ) -> None: + def __init__(self, *, required_zone_names: Optional[List[str]] = None, **kwargs: Any) -> None: """ - :keyword client_id: The client id of the custom Open ID Connect provider. - :paramtype client_id: str - :keyword client_credential: The authentication credentials of the custom Open ID Connect - provider. - :paramtype client_credential: ~azure.mgmt.appcontainers.models.OpenIdConnectClientCredential - :keyword open_id_connect_configuration: The configuration settings of the endpoints used for - the custom Open ID Connect provider. - :paramtype open_id_connect_configuration: ~azure.mgmt.appcontainers.models.OpenIdConnectConfig + :keyword required_zone_names: The private link resource private link DNS zone name. + :paramtype required_zone_names: list[str] """ super().__init__(**kwargs) - self.client_id = client_id - self.client_credential = client_credential - self.open_id_connect_configuration = open_id_connect_configuration + self.group_id: Optional[str] = None + self.required_members: Optional[List[str]] = None + self.required_zone_names = required_zone_names -class OperationDetail(_serialization.Model): - """Operation detail payload. +class PrivateLinkResourceListResult(_serialization.Model): + """A list of private link resources. - :ivar name: Name of the operation. - :vartype name: str - :ivar is_data_action: Indicates whether the operation is a data action. - :vartype is_data_action: bool - :ivar display: Display of the operation. - :vartype display: ~azure.mgmt.appcontainers.models.OperationDisplay - :ivar origin: Origin of the operation. - :vartype origin: str + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: Array of private link resources. + :vartype value: list[~azure.mgmt.appcontainers.models.PrivateLinkResource] + :ivar next_link: URL to get the next set of operation list results (if there are any). + :vartype next_link: str """ + _validation = { + "next_link": {"readonly": True}, + } + _attribute_map = { - "name": {"key": "name", "type": "str"}, - "is_data_action": {"key": "isDataAction", "type": "bool"}, - "display": {"key": "display", "type": "OperationDisplay"}, - "origin": {"key": "origin", "type": "str"}, + "value": {"key": "value", "type": "[PrivateLinkResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - name: Optional[str] = None, - is_data_action: Optional[bool] = None, - display: Optional["_models.OperationDisplay"] = None, - origin: Optional[str] = None, - **kwargs: Any - ) -> None: + def __init__(self, *, value: Optional[List["_models.PrivateLinkResource"]] = None, **kwargs: Any) -> None: """ - :keyword name: Name of the operation. - :paramtype name: str - :keyword is_data_action: Indicates whether the operation is a data action. - :paramtype is_data_action: bool - :keyword display: Display of the operation. - :paramtype display: ~azure.mgmt.appcontainers.models.OperationDisplay - :keyword origin: Origin of the operation. - :paramtype origin: str + :keyword value: Array of private link resources. + :paramtype value: list[~azure.mgmt.appcontainers.models.PrivateLinkResource] """ super().__init__(**kwargs) - self.name = name - self.is_data_action = is_data_action - self.display = display - self.origin = origin + self.value = value + self.next_link: Optional[str] = None -class OperationDisplay(_serialization.Model): - """Operation display payload. +class PrivateLinkServiceConnectionState(_serialization.Model): + """A collection of information about the state of the connection between service consumer and + provider. - :ivar provider: Resource provider of the operation. - :vartype provider: str - :ivar resource: Resource of the operation. - :vartype resource: str - :ivar operation: Localized friendly name for the operation. - :vartype operation: str - :ivar description: Localized friendly description for the operation. + :ivar status: Indicates whether the connection has been Approved/Rejected/Removed by the owner + of the service. Known values are: "Pending", "Approved", "Rejected", and "Disconnected". + :vartype status: str or ~azure.mgmt.appcontainers.models.PrivateEndpointServiceConnectionStatus + :ivar description: The reason for approval/rejection of the connection. :vartype description: str + :ivar actions_required: A message indicating if changes on the service provider require any + updates on the consumer. + :vartype actions_required: str """ _attribute_map = { - "provider": {"key": "provider", "type": "str"}, - "resource": {"key": "resource", "type": "str"}, - "operation": {"key": "operation", "type": "str"}, + "status": {"key": "status", "type": "str"}, "description": {"key": "description", "type": "str"}, + "actions_required": {"key": "actionsRequired", "type": "str"}, } def __init__( self, *, - provider: Optional[str] = None, - resource: Optional[str] = None, - operation: Optional[str] = None, + status: Optional[Union[str, "_models.PrivateEndpointServiceConnectionStatus"]] = None, description: Optional[str] = None, + actions_required: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword provider: Resource provider of the operation. - :paramtype provider: str - :keyword resource: Resource of the operation. - :paramtype resource: str - :keyword operation: Localized friendly name for the operation. - :paramtype operation: str - :keyword description: Localized friendly description for the operation. + :keyword status: Indicates whether the connection has been Approved/Rejected/Removed by the + owner of the service. Known values are: "Pending", "Approved", "Rejected", and "Disconnected". + :paramtype status: str or + ~azure.mgmt.appcontainers.models.PrivateEndpointServiceConnectionStatus + :keyword description: The reason for approval/rejection of the connection. :paramtype description: str + :keyword actions_required: A message indicating if changes on the service provider require any + updates on the consumer. + :paramtype actions_required: str """ super().__init__(**kwargs) - self.provider = provider - self.resource = resource - self.operation = operation + self.status = status self.description = description + self.actions_required = actions_required class QueueScaleRule(_serialization.Model): @@ -7823,7 +12109,7 @@ class Replica(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -7882,9 +12168,9 @@ def __init__( :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.created_time: Optional[datetime.datetime] = None + self.running_state: Optional[Union[str, "_models.ContainerAppReplicaRunningState"]] = None + self.running_state_details: Optional[str] = None self.containers = containers self.init_containers = init_containers @@ -7940,6 +12226,8 @@ class ReplicaContainer(_serialization.Model): :vartype log_stream_endpoint: str :ivar exec_endpoint: Container exec endpoint. :vartype exec_endpoint: str + :ivar debug_endpoint: Container debug endpoint. + :vartype debug_endpoint: str """ _validation = { @@ -7947,6 +12235,7 @@ class ReplicaContainer(_serialization.Model): "running_state_details": {"readonly": True}, "log_stream_endpoint": {"readonly": True}, "exec_endpoint": {"readonly": True}, + "debug_endpoint": {"readonly": True}, } _attribute_map = { @@ -7959,6 +12248,7 @@ class ReplicaContainer(_serialization.Model): "running_state_details": {"key": "runningStateDetails", "type": "str"}, "log_stream_endpoint": {"key": "logStreamEndpoint", "type": "str"}, "exec_endpoint": {"key": "execEndpoint", "type": "str"}, + "debug_endpoint": {"key": "debugEndpoint", "type": "str"}, } def __init__( @@ -7989,10 +12279,43 @@ 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 + self.running_state: Optional[Union[str, "_models.ContainerAppContainerRunningState"]] = None + self.running_state_details: Optional[str] = None + self.log_stream_endpoint: Optional[str] = None + self.exec_endpoint: Optional[str] = None + self.debug_endpoint: Optional[str] = None + + +class ReplicaExecutionStatus(_serialization.Model): + """Container Apps Job execution replica status. + + :ivar name: Replica Name. + :vartype name: str + :ivar containers: Containers in the execution replica. + :vartype containers: list[~azure.mgmt.appcontainers.models.ContainerExecutionStatus] + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "containers": {"key": "containers", "type": "[ContainerExecutionStatus]"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + containers: Optional[List["_models.ContainerExecutionStatus"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: Replica Name. + :paramtype name: str + :keyword containers: Containers in the execution replica. + :paramtype containers: list[~azure.mgmt.appcontainers.models.ContainerExecutionStatus] + """ + super().__init__(**kwargs) + self.name = name + self.containers = containers class Revision(ProxyResource): @@ -8001,7 +12324,7 @@ class Revision(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -8029,6 +12352,8 @@ class Revision(ProxyResource): :vartype replicas: int :ivar traffic_weight: Traffic weight assigned to this revision. :vartype traffic_weight: int + :ivar labels: List of labels assigned to this revision. + :vartype labels: list[str] :ivar provisioning_error: Optional Field - Platform Error Message. :vartype provisioning_error: str :ivar health_state: Current health State of the revision. Known values are: "Healthy", @@ -8054,6 +12379,7 @@ class Revision(ProxyResource): "active": {"readonly": True}, "replicas": {"readonly": True}, "traffic_weight": {"readonly": True}, + "labels": {"readonly": True}, "provisioning_error": {"readonly": True}, "health_state": {"readonly": True}, "provisioning_state": {"readonly": True}, @@ -8072,6 +12398,7 @@ class Revision(ProxyResource): "active": {"key": "properties.active", "type": "bool"}, "replicas": {"key": "properties.replicas", "type": "int"}, "traffic_weight": {"key": "properties.trafficWeight", "type": "int"}, + "labels": {"key": "properties.labels", "type": "[str]"}, "provisioning_error": {"key": "properties.provisioningError", "type": "str"}, "health_state": {"key": "properties.healthState", "type": "str"}, "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, @@ -8081,17 +12408,18 @@ class Revision(ProxyResource): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.created_time = None - self.last_active_time = None - self.fqdn = None - self.template = None - self.active = None - self.replicas = None - self.traffic_weight = None - self.provisioning_error = None - self.health_state = None - self.provisioning_state = None - self.running_state = None + self.created_time: Optional[datetime.datetime] = None + self.last_active_time: Optional[datetime.datetime] = None + self.fqdn: Optional[str] = None + self.template: Optional["_models.Template"] = None + self.active: Optional[bool] = None + self.replicas: Optional[int] = None + self.traffic_weight: Optional[int] = None + self.labels: Optional[List[str]] = None + self.provisioning_error: Optional[str] = None + self.health_state: Optional[Union[str, "_models.RevisionHealthState"]] = None + self.provisioning_state: Optional[Union[str, "_models.RevisionProvisioningState"]] = None + self.running_state: Optional[Union[str, "_models.RevisionRunningState"]] = None class RevisionCollection(_serialization.Model): @@ -8124,7 +12452,7 @@ def __init__(self, *, value: List["_models.Revision"], **kwargs: Any) -> None: """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class Runtime(_serialization.Model): @@ -8132,19 +12460,52 @@ class Runtime(_serialization.Model): :ivar java: Java app configuration. :vartype java: ~azure.mgmt.appcontainers.models.RuntimeJava + :ivar dotnet: .NET app configuration. + :vartype dotnet: ~azure.mgmt.appcontainers.models.RuntimeDotnet """ _attribute_map = { "java": {"key": "java", "type": "RuntimeJava"}, + "dotnet": {"key": "dotnet", "type": "RuntimeDotnet"}, } - def __init__(self, *, java: Optional["_models.RuntimeJava"] = None, **kwargs: Any) -> None: + def __init__( + self, + *, + java: Optional["_models.RuntimeJava"] = None, + dotnet: Optional["_models.RuntimeDotnet"] = None, + **kwargs: Any + ) -> None: """ :keyword java: Java app configuration. :paramtype java: ~azure.mgmt.appcontainers.models.RuntimeJava + :keyword dotnet: .NET app configuration. + :paramtype dotnet: ~azure.mgmt.appcontainers.models.RuntimeDotnet """ super().__init__(**kwargs) self.java = java + self.dotnet = dotnet + + +class RuntimeDotnet(_serialization.Model): + """.NET app configuration. + + :ivar auto_configure_data_protection: Auto configure the ASP.NET Core Data Protection feature. + :vartype auto_configure_data_protection: bool + """ + + _attribute_map = { + "auto_configure_data_protection": {"key": "autoConfigureDataProtection", "type": "bool"}, + } + + def __init__(self, *, auto_configure_data_protection: Optional[bool] = None, **kwargs: Any) -> None: + """ + :keyword auto_configure_data_protection: Auto configure the ASP.NET Core Data Protection + feature. + :paramtype auto_configure_data_protection: bool + """ + super().__init__(**kwargs) + self.auto_configure_data_protection = auto_configure_data_protection class RuntimeJava(_serialization.Model): @@ -8152,19 +12513,83 @@ class RuntimeJava(_serialization.Model): :ivar enable_metrics: Enable jmx core metrics for the java app. :vartype enable_metrics: bool + :ivar java_agent: Diagnostic capabilities achieved by java agent. + :vartype java_agent: ~azure.mgmt.appcontainers.models.RuntimeJavaAgent """ _attribute_map = { "enable_metrics": {"key": "enableMetrics", "type": "bool"}, + "java_agent": {"key": "javaAgent", "type": "RuntimeJavaAgent"}, } - def __init__(self, *, enable_metrics: Optional[bool] = None, **kwargs: Any) -> None: + def __init__( + self, + *, + enable_metrics: Optional[bool] = None, + java_agent: Optional["_models.RuntimeJavaAgent"] = None, + **kwargs: Any + ) -> None: """ :keyword enable_metrics: Enable jmx core metrics for the java app. :paramtype enable_metrics: bool + :keyword java_agent: Diagnostic capabilities achieved by java agent. + :paramtype java_agent: ~azure.mgmt.appcontainers.models.RuntimeJavaAgent """ super().__init__(**kwargs) self.enable_metrics = enable_metrics + self.java_agent = java_agent + + +class RuntimeJavaAgent(_serialization.Model): + """Diagnostic capabilities achieved by java agent. + + :ivar enabled: Enable java agent injection for the java app. + :vartype enabled: bool + :ivar logging: Capabilities on the java logging scenario. + :vartype logging: ~azure.mgmt.appcontainers.models.RuntimeJavaAgentLogging + """ + + _attribute_map = { + "enabled": {"key": "enabled", "type": "bool"}, + "logging": {"key": "logging", "type": "RuntimeJavaAgentLogging"}, + } + + def __init__( + self, + *, + enabled: Optional[bool] = None, + logging: Optional["_models.RuntimeJavaAgentLogging"] = None, + **kwargs: Any + ) -> None: + """ + :keyword enabled: Enable java agent injection for the java app. + :paramtype enabled: bool + :keyword logging: Capabilities on the java logging scenario. + :paramtype logging: ~azure.mgmt.appcontainers.models.RuntimeJavaAgentLogging + """ + super().__init__(**kwargs) + self.enabled = enabled + self.logging = logging + + +class RuntimeJavaAgentLogging(_serialization.Model): + """Capabilities on the java logging scenario. + + :ivar logger_settings: Settings of the logger for the java app. + :vartype logger_settings: list[~azure.mgmt.appcontainers.models.LoggerSetting] + """ + + _attribute_map = { + "logger_settings": {"key": "loggerSettings", "type": "[LoggerSetting]"}, + } + + def __init__(self, *, logger_settings: Optional[List["_models.LoggerSetting"]] = None, **kwargs: Any) -> None: + """ + :keyword logger_settings: Settings of the logger for the java app. + :paramtype logger_settings: list[~azure.mgmt.appcontainers.models.LoggerSetting] + """ + super().__init__(**kwargs) + self.logger_settings = logger_settings class Scale(_serialization.Model): @@ -8174,11 +12599,9 @@ class Scale(_serialization.Model): :vartype min_replicas: int :ivar max_replicas: Optional. Maximum number of container replicas. Defaults to 10 if not set. :vartype max_replicas: int - :ivar cooldown_period: Optional. KEDA Cooldown Period in seconds. Defaults to 300 seconds if - not set. + :ivar cooldown_period: Optional. KEDA Cooldown Period. Defaults to 300 seconds if not set. :vartype cooldown_period: int - :ivar polling_interval: Optional. KEDA Polling Interval in seconds. Defaults to 30 seconds if - not set. + :ivar polling_interval: Optional. KEDA Polling Interval. Defaults to 30 seconds if not set. :vartype polling_interval: int :ivar rules: Scaling rules. :vartype rules: list[~azure.mgmt.appcontainers.models.ScaleRule] @@ -8208,11 +12631,9 @@ def __init__( :keyword max_replicas: Optional. Maximum number of container replicas. Defaults to 10 if not set. :paramtype max_replicas: int - :keyword cooldown_period: Optional. KEDA Cooldown Period in seconds. Defaults to 300 seconds if - not set. + :keyword cooldown_period: Optional. KEDA Cooldown Period. Defaults to 300 seconds if not set. :paramtype cooldown_period: int - :keyword polling_interval: Optional. KEDA Polling Interval in seconds. Defaults to 30 seconds - if not set. + :keyword polling_interval: Optional. KEDA Polling Interval. Defaults to 30 seconds if not set. :paramtype polling_interval: int :keyword rules: Scaling rules. :paramtype rules: list[~azure.mgmt.appcontainers.models.ScaleRule] @@ -8338,6 +12759,112 @@ def __init__( self.trigger_parameter = trigger_parameter +class ScgRoute(_serialization.Model): + """Spring Cloud Gateway route definition. + + All required parameters must be populated in order to send to server. + + :ivar id: Id of the route. Required. + :vartype id: str + :ivar uri: Uri of the route. Required. + :vartype uri: str + :ivar predicates: Predicates of the route. + :vartype predicates: list[str] + :ivar filters: Filters of the route. + :vartype filters: list[str] + :ivar order: Order of the route. + :vartype order: int + """ + + _validation = { + "id": {"required": True}, + "uri": {"required": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "uri": {"key": "uri", "type": "str"}, + "predicates": {"key": "predicates", "type": "[str]"}, + "filters": {"key": "filters", "type": "[str]"}, + "order": {"key": "order", "type": "int"}, + } + + def __init__( + self, + *, + id: str, # pylint: disable=redefined-builtin + uri: str, + predicates: Optional[List[str]] = None, + filters: Optional[List[str]] = None, + order: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Id of the route. Required. + :paramtype id: str + :keyword uri: Uri of the route. Required. + :paramtype uri: str + :keyword predicates: Predicates of the route. + :paramtype predicates: list[str] + :keyword filters: Filters of the route. + :paramtype filters: list[str] + :keyword order: Order of the route. + :paramtype order: int + """ + super().__init__(**kwargs) + self.id = id + self.uri = uri + self.predicates = predicates + self.filters = filters + self.order = order + + +class ScheduledEntry(_serialization.Model): + """Maintenance schedule entry for a managed environment. + + All required parameters must be populated in order to send to server. + + :ivar week_day: Day of the week when a managed environment can be patched. Required. Known + values are: "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", and "Sunday". + :vartype week_day: str or ~azure.mgmt.appcontainers.models.WeekDay + :ivar start_hour_utc: Start hour after which managed environment maintenance can start from 0 + to 23 hour. Required. + :vartype start_hour_utc: int + :ivar duration_hours: Length of maintenance window range from 8 to 24 hours. Required. + :vartype duration_hours: int + """ + + _validation = { + "week_day": {"required": True}, + "start_hour_utc": {"required": True}, + "duration_hours": {"required": True}, + } + + _attribute_map = { + "week_day": {"key": "weekDay", "type": "str"}, + "start_hour_utc": {"key": "startHourUtc", "type": "int"}, + "duration_hours": {"key": "durationHours", "type": "int"}, + } + + def __init__( + self, *, week_day: Union[str, "_models.WeekDay"], start_hour_utc: int, duration_hours: int, **kwargs: Any + ) -> None: + """ + :keyword week_day: Day of the week when a managed environment can be patched. Required. Known + values are: "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", and "Sunday". + :paramtype week_day: str or ~azure.mgmt.appcontainers.models.WeekDay + :keyword start_hour_utc: Start hour after which managed environment maintenance can start from + 0 to 23 hour. Required. + :paramtype start_hour_utc: int + :keyword duration_hours: Length of maintenance window range from 8 to 24 hours. Required. + :paramtype duration_hours: int + """ + super().__init__(**kwargs) + self.week_day = week_day + self.start_hour_utc = start_hour_utc + self.duration_hours = duration_hours + + class Secret(_serialization.Model): """Secret definition. @@ -8388,6 +12915,34 @@ def __init__( self.key_vault_url = key_vault_url +class SecretKeyVaultProperties(_serialization.Model): + """Properties for a secret stored in a Key Vault. + + :ivar identity: Resource ID of a managed identity to authenticate with Azure Key Vault, or + System to use a system-assigned identity. + :vartype identity: str + :ivar key_vault_url: URL pointing to the Azure Key Vault secret. + :vartype key_vault_url: str + """ + + _attribute_map = { + "identity": {"key": "identity", "type": "str"}, + "key_vault_url": {"key": "keyVaultUrl", "type": "str"}, + } + + def __init__(self, *, identity: Optional[str] = None, key_vault_url: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword identity: Resource ID of a managed identity to authenticate with Azure Key Vault, or + System to use a system-assigned identity. + :paramtype identity: str + :keyword key_vault_url: URL pointing to the Azure Key Vault secret. + :paramtype key_vault_url: str + """ + super().__init__(**kwargs) + self.identity = identity + self.key_vault_url = key_vault_url + + class SecretsCollection(_serialization.Model): """Container App Secrets Collection ARM resource. @@ -8475,23 +13030,43 @@ class ServiceBind(_serialization.Model): :vartype service_id: str :ivar name: Name of the service bind. :vartype name: str + :ivar client_type: Type of the client to be used to connect to the service. + :vartype client_type: str + :ivar customized_keys: Customized keys for customizing injected values to the app. + :vartype customized_keys: dict[str, str] """ _attribute_map = { "service_id": {"key": "serviceId", "type": "str"}, "name": {"key": "name", "type": "str"}, + "client_type": {"key": "clientType", "type": "str"}, + "customized_keys": {"key": "customizedKeys", "type": "{str}"}, } - def __init__(self, *, service_id: Optional[str] = None, name: Optional[str] = None, **kwargs: Any) -> None: + def __init__( + self, + *, + service_id: Optional[str] = None, + name: Optional[str] = None, + client_type: Optional[str] = None, + customized_keys: Optional[Dict[str, str]] = None, + **kwargs: Any + ) -> None: """ :keyword service_id: Resource id of the target service. :paramtype service_id: str :keyword name: Name of the service bind. :paramtype name: str + :keyword client_type: Type of the client to be used to connect to the service. + :paramtype client_type: str + :keyword customized_keys: Customized keys for customizing injected values to the app. + :paramtype customized_keys: dict[str, str] """ super().__init__(**kwargs) self.service_id = service_id self.name = name + self.client_type = client_type + self.customized_keys = customized_keys class SessionContainer(_serialization.Model): @@ -8509,6 +13084,8 @@ class SessionContainer(_serialization.Model): :vartype env: list[~azure.mgmt.appcontainers.models.EnvironmentVar] :ivar resources: Container resource requirements. :vartype resources: ~azure.mgmt.appcontainers.models.SessionContainerResources + :ivar probes: List of probes for the container. + :vartype probes: list[~azure.mgmt.appcontainers.models.SessionProbe] """ _attribute_map = { @@ -8518,6 +13095,7 @@ class SessionContainer(_serialization.Model): "args": {"key": "args", "type": "[str]"}, "env": {"key": "env", "type": "[EnvironmentVar]"}, "resources": {"key": "resources", "type": "SessionContainerResources"}, + "probes": {"key": "probes", "type": "[SessionProbe]"}, } def __init__( @@ -8529,6 +13107,7 @@ def __init__( args: Optional[List[str]] = None, env: Optional[List["_models.EnvironmentVar"]] = None, resources: Optional["_models.SessionContainerResources"] = None, + probes: Optional[List["_models.SessionProbe"]] = None, **kwargs: Any ) -> None: """ @@ -8544,6 +13123,8 @@ def __init__( :paramtype env: list[~azure.mgmt.appcontainers.models.EnvironmentVar] :keyword resources: Container resource requirements. :paramtype resources: ~azure.mgmt.appcontainers.models.SessionContainerResources + :keyword probes: List of probes for the container. + :paramtype probes: list[~azure.mgmt.appcontainers.models.SessionProbe] """ super().__init__(**kwargs) self.image = image @@ -8552,6 +13133,7 @@ def __init__( self.args = args self.env = env self.resources = resources + self.probes = probes class SessionContainerResources(_serialization.Model): @@ -8630,7 +13212,7 @@ class SessionPool(TrackedResource): All required parameters must be populated in order to send to server. :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -8774,74 +13356,372 @@ def __init__( :paramtype managed_identity_settings: list[~azure.mgmt.appcontainers.models.ManagedIdentitySetting] """ - super().__init__(tags=tags, location=location, **kwargs) - self.identity = identity - self.environment_id = environment_id - self.container_type = container_type - self.pool_management_type = pool_management_type - self.node_count = None - self.scale_configuration = scale_configuration - self.secrets = secrets - self.dynamic_pool_configuration = dynamic_pool_configuration - self.custom_container_template = custom_container_template - self.session_network_configuration = session_network_configuration - self.pool_management_endpoint = None - self.provisioning_state = None - self.managed_identity_settings = managed_identity_settings - + super().__init__(tags=tags, location=location, **kwargs) + self.identity = identity + self.environment_id = environment_id + self.container_type = container_type + self.pool_management_type = pool_management_type + self.node_count: Optional[int] = None + self.scale_configuration = scale_configuration + self.secrets = secrets + self.dynamic_pool_configuration = dynamic_pool_configuration + self.custom_container_template = custom_container_template + self.session_network_configuration = session_network_configuration + self.pool_management_endpoint: Optional[str] = None + self.provisioning_state: Optional[Union[str, "_models.SessionPoolProvisioningState"]] = None + self.managed_identity_settings = managed_identity_settings + + +class SessionPoolCollection(_serialization.Model): + """Session pool collection Azure resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar value: Collection of resources. Required. + :vartype value: list[~azure.mgmt.appcontainers.models.SessionPool] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[SessionPool]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.SessionPool"], **kwargs: Any) -> None: + """ + :keyword value: Collection of resources. Required. + :paramtype value: list[~azure.mgmt.appcontainers.models.SessionPool] + """ + super().__init__(**kwargs) + self.value = value + self.next_link: Optional[str] = None + + +class SessionPoolSecret(_serialization.Model): + """Secret definition. + + :ivar name: Secret Name. + :vartype name: str + :ivar value: Secret Value. + :vartype value: str + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "value": {"key": "value", "type": "str"}, + } + + def __init__(self, *, name: Optional[str] = None, value: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword name: Secret Name. + :paramtype name: str + :keyword value: Secret Value. + :paramtype value: str + """ + super().__init__(**kwargs) + self.name = name + self.value = value + + +class SessionPoolUpdatableProperties(_serialization.Model): + """Container App session pool updatable properties. + + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar identity: Managed identities needed by a session pool to interact with other Azure + services to not maintain any secrets or credentials in code. + :vartype identity: ~azure.mgmt.appcontainers.models.ManagedServiceIdentity + :ivar scale_configuration: The scale configuration of the session pool. + :vartype scale_configuration: ~azure.mgmt.appcontainers.models.ScaleConfiguration + :ivar secrets: The secrets of the session pool. + :vartype secrets: list[~azure.mgmt.appcontainers.models.SessionPoolSecret] + :ivar dynamic_pool_configuration: The pool configuration if the poolManagementType is dynamic. + :vartype dynamic_pool_configuration: ~azure.mgmt.appcontainers.models.DynamicPoolConfiguration + :ivar custom_container_template: The custom container configuration if the containerType is + CustomContainer. + :vartype custom_container_template: ~azure.mgmt.appcontainers.models.CustomContainerTemplate + :ivar session_network_configuration: The network configuration of the sessions in the session + pool. + :vartype session_network_configuration: + ~azure.mgmt.appcontainers.models.SessionNetworkConfiguration + """ + + _attribute_map = { + "tags": {"key": "tags", "type": "{str}"}, + "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, + "scale_configuration": {"key": "properties.scaleConfiguration", "type": "ScaleConfiguration"}, + "secrets": {"key": "properties.secrets", "type": "[SessionPoolSecret]"}, + "dynamic_pool_configuration": { + "key": "properties.dynamicPoolConfiguration", + "type": "DynamicPoolConfiguration", + }, + "custom_container_template": {"key": "properties.customContainerTemplate", "type": "CustomContainerTemplate"}, + "session_network_configuration": { + "key": "properties.sessionNetworkConfiguration", + "type": "SessionNetworkConfiguration", + }, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, + scale_configuration: Optional["_models.ScaleConfiguration"] = None, + secrets: Optional[List["_models.SessionPoolSecret"]] = None, + dynamic_pool_configuration: Optional["_models.DynamicPoolConfiguration"] = None, + custom_container_template: Optional["_models.CustomContainerTemplate"] = None, + session_network_configuration: Optional["_models.SessionNetworkConfiguration"] = None, + **kwargs: Any + ) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword identity: Managed identities needed by a session pool to interact with other Azure + services to not maintain any secrets or credentials in code. + :paramtype identity: ~azure.mgmt.appcontainers.models.ManagedServiceIdentity + :keyword scale_configuration: The scale configuration of the session pool. + :paramtype scale_configuration: ~azure.mgmt.appcontainers.models.ScaleConfiguration + :keyword secrets: The secrets of the session pool. + :paramtype secrets: list[~azure.mgmt.appcontainers.models.SessionPoolSecret] + :keyword dynamic_pool_configuration: The pool configuration if the poolManagementType is + dynamic. + :paramtype dynamic_pool_configuration: + ~azure.mgmt.appcontainers.models.DynamicPoolConfiguration + :keyword custom_container_template: The custom container configuration if the containerType is + CustomContainer. + :paramtype custom_container_template: ~azure.mgmt.appcontainers.models.CustomContainerTemplate + :keyword session_network_configuration: The network configuration of the sessions in the + session pool. + :paramtype session_network_configuration: + ~azure.mgmt.appcontainers.models.SessionNetworkConfiguration + """ + super().__init__(**kwargs) + self.tags = tags + self.identity = identity + self.scale_configuration = scale_configuration + self.secrets = secrets + self.dynamic_pool_configuration = dynamic_pool_configuration + self.custom_container_template = custom_container_template + self.session_network_configuration = session_network_configuration + + +class SessionProbe(_serialization.Model): + """Session probe configuration. + + :ivar type: Denotes the type of probe. Can be Liveness or Startup, Readiness probe is not + supported in sessions. Type must be unique for each probe within the context of a list of + probes (SessionProbes). Known values are: "Liveness" and "Startup". + :vartype type: str or ~azure.mgmt.appcontainers.models.SessionProbeType + :ivar http_get: HTTPGet specifies the http request to perform. + :vartype http_get: ~azure.mgmt.appcontainers.models.SessionProbeHttpGet + :ivar tcp_socket: TCPSocket specifies an action involving a TCP port. TCP hooks not yet + supported. + :vartype tcp_socket: ~azure.mgmt.appcontainers.models.SessionProbeTcpSocket + :ivar failure_threshold: Minimum consecutive failures for the probe to be considered failed + after having succeeded. Defaults to 3. Minimum value is 1. Maximum value is 10. + :vartype failure_threshold: int + :ivar initial_delay_seconds: Number of seconds after the container has started before liveness + probes are initiated. Minimum value is 1. Maximum value is 60. + :vartype initial_delay_seconds: int + :ivar period_seconds: How often (in seconds) to perform the probe. Default to 10 seconds. + Minimum value is 1. Maximum value is 240. + :vartype period_seconds: int + :ivar success_threshold: Minimum consecutive successes for the probe to be considered + successful after having failed. Defaults to 1. Must be 1 for liveness and startup. Minimum + value is 1. Maximum value is 10. + :vartype success_threshold: int + :ivar termination_grace_period_seconds: Optional duration in seconds the pod needs to terminate + gracefully upon probe failure. The grace period is the duration in seconds after the processes + running in the pod are sent a termination signal and the time when the processes are forcibly + halted with a kill signal. Set this value longer than the expected cleanup time for your + process. If this value is nil, the pod's terminationGracePeriodSeconds will be used. Otherwise, + this value overrides the value provided by the pod spec. Value must be non-negative integer. + The value zero indicates stop immediately via the kill signal (no opportunity to shut down). + This is an alpha field and requires enabling ProbeTerminationGracePeriod feature gate. Maximum + value is 3600 seconds (1 hour). + :vartype termination_grace_period_seconds: int + :ivar timeout_seconds: Number of seconds after which the probe times out. Defaults to 1 second. + Minimum value is 1. Maximum value is 240. + :vartype timeout_seconds: int + """ + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + "http_get": {"key": "httpGet", "type": "SessionProbeHttpGet"}, + "tcp_socket": {"key": "tcpSocket", "type": "SessionProbeTcpSocket"}, + "failure_threshold": {"key": "failureThreshold", "type": "int"}, + "initial_delay_seconds": {"key": "initialDelaySeconds", "type": "int"}, + "period_seconds": {"key": "periodSeconds", "type": "int"}, + "success_threshold": {"key": "successThreshold", "type": "int"}, + "termination_grace_period_seconds": {"key": "terminationGracePeriodSeconds", "type": "int"}, + "timeout_seconds": {"key": "timeoutSeconds", "type": "int"}, + } + + def __init__( + self, + *, + type: Optional[Union[str, "_models.SessionProbeType"]] = None, + http_get: Optional["_models.SessionProbeHttpGet"] = None, + tcp_socket: Optional["_models.SessionProbeTcpSocket"] = None, + failure_threshold: Optional[int] = None, + initial_delay_seconds: Optional[int] = None, + period_seconds: Optional[int] = None, + success_threshold: Optional[int] = None, + termination_grace_period_seconds: Optional[int] = None, + timeout_seconds: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword type: Denotes the type of probe. Can be Liveness or Startup, Readiness probe is not + supported in sessions. Type must be unique for each probe within the context of a list of + probes (SessionProbes). Known values are: "Liveness" and "Startup". + :paramtype type: str or ~azure.mgmt.appcontainers.models.SessionProbeType + :keyword http_get: HTTPGet specifies the http request to perform. + :paramtype http_get: ~azure.mgmt.appcontainers.models.SessionProbeHttpGet + :keyword tcp_socket: TCPSocket specifies an action involving a TCP port. TCP hooks not yet + supported. + :paramtype tcp_socket: ~azure.mgmt.appcontainers.models.SessionProbeTcpSocket + :keyword failure_threshold: Minimum consecutive failures for the probe to be considered failed + after having succeeded. Defaults to 3. Minimum value is 1. Maximum value is 10. + :paramtype failure_threshold: int + :keyword initial_delay_seconds: Number of seconds after the container has started before + liveness probes are initiated. Minimum value is 1. Maximum value is 60. + :paramtype initial_delay_seconds: int + :keyword period_seconds: How often (in seconds) to perform the probe. Default to 10 seconds. + Minimum value is 1. Maximum value is 240. + :paramtype period_seconds: int + :keyword success_threshold: Minimum consecutive successes for the probe to be considered + successful after having failed. Defaults to 1. Must be 1 for liveness and startup. Minimum + value is 1. Maximum value is 10. + :paramtype success_threshold: int + :keyword termination_grace_period_seconds: Optional duration in seconds the pod needs to + terminate gracefully upon probe failure. The grace period is the duration in seconds after the + processes running in the pod are sent a termination signal and the time when the processes are + forcibly halted with a kill signal. Set this value longer than the expected cleanup time for + your process. If this value is nil, the pod's terminationGracePeriodSeconds will be used. + Otherwise, this value overrides the value provided by the pod spec. Value must be non-negative + integer. The value zero indicates stop immediately via the kill signal (no opportunity to shut + down). This is an alpha field and requires enabling ProbeTerminationGracePeriod feature gate. + Maximum value is 3600 seconds (1 hour). + :paramtype termination_grace_period_seconds: int + :keyword timeout_seconds: Number of seconds after which the probe times out. Defaults to 1 + second. Minimum value is 1. Maximum value is 240. + :paramtype timeout_seconds: int + """ + super().__init__(**kwargs) + self.type = type + self.http_get = http_get + self.tcp_socket = tcp_socket + self.failure_threshold = failure_threshold + self.initial_delay_seconds = initial_delay_seconds + self.period_seconds = period_seconds + self.success_threshold = success_threshold + self.termination_grace_period_seconds = termination_grace_period_seconds + self.timeout_seconds = timeout_seconds -class SessionPoolCollection(_serialization.Model): - """Session pool collection Azure resource. - Variables are only populated by the server, and will be ignored when sending a request. +class SessionProbeHttpGet(_serialization.Model): + """HTTPGet specifies the http request to perform. All required parameters must be populated in order to send to server. - :ivar value: Collection of resources. Required. - :vartype value: list[~azure.mgmt.appcontainers.models.SessionPool] - :ivar next_link: Link to next page of resources. - :vartype next_link: str + :ivar host: Host name to connect to, defaults to the pod IP. You probably want to set "Host" in + httpHeaders instead. + :vartype host: str + :ivar http_headers: Custom headers to set in the request. HTTP allows repeated headers. + :vartype http_headers: + list[~azure.mgmt.appcontainers.models.SessionProbeHttpGetHttpHeadersItem] + :ivar path: Path to access on the HTTP server. + :vartype path: str + :ivar port: Name or number of the port to access on the container. Number must be in the range + 1 to 65535. Name must be an IANA_SVC_NAME. Required. + :vartype port: int + :ivar scheme: Scheme to use for connecting to the host. Defaults to HTTP. Known values are: + "HTTP" and "HTTPS". + :vartype scheme: str or ~azure.mgmt.appcontainers.models.Scheme """ _validation = { - "value": {"required": True}, - "next_link": {"readonly": True}, + "port": {"required": True}, } _attribute_map = { - "value": {"key": "value", "type": "[SessionPool]"}, - "next_link": {"key": "nextLink", "type": "str"}, + "host": {"key": "host", "type": "str"}, + "http_headers": {"key": "httpHeaders", "type": "[SessionProbeHttpGetHttpHeadersItem]"}, + "path": {"key": "path", "type": "str"}, + "port": {"key": "port", "type": "int"}, + "scheme": {"key": "scheme", "type": "str"}, } - def __init__(self, *, value: List["_models.SessionPool"], **kwargs: Any) -> None: + def __init__( + self, + *, + port: int, + host: Optional[str] = None, + http_headers: Optional[List["_models.SessionProbeHttpGetHttpHeadersItem"]] = None, + path: Optional[str] = None, + scheme: Optional[Union[str, "_models.Scheme"]] = None, + **kwargs: Any + ) -> None: """ - :keyword value: Collection of resources. Required. - :paramtype value: list[~azure.mgmt.appcontainers.models.SessionPool] + :keyword host: Host name to connect to, defaults to the pod IP. You probably want to set "Host" + in httpHeaders instead. + :paramtype host: str + :keyword http_headers: Custom headers to set in the request. HTTP allows repeated headers. + :paramtype http_headers: + list[~azure.mgmt.appcontainers.models.SessionProbeHttpGetHttpHeadersItem] + :keyword path: Path to access on the HTTP server. + :paramtype path: str + :keyword port: Name or number of the port to access on the container. Number must be in the + range 1 to 65535. Name must be an IANA_SVC_NAME. Required. + :paramtype port: int + :keyword scheme: Scheme to use for connecting to the host. Defaults to HTTP. Known values are: + "HTTP" and "HTTPS". + :paramtype scheme: str or ~azure.mgmt.appcontainers.models.Scheme """ super().__init__(**kwargs) - self.value = value - self.next_link = None + self.host = host + self.http_headers = http_headers + self.path = path + self.port = port + self.scheme = scheme -class SessionPoolSecret(_serialization.Model): - """Secret definition. +class SessionProbeHttpGetHttpHeadersItem(_serialization.Model): + """HTTPHeader describes a custom header to be used in HTTP probes. - :ivar name: Secret Name. + All required parameters must be populated in order to send to server. + + :ivar name: The header field name. Required. :vartype name: str - :ivar value: Secret Value. + :ivar value: The header field 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: Optional[str] = None, value: Optional[str] = None, **kwargs: Any) -> None: + def __init__(self, *, name: str, value: str, **kwargs: Any) -> None: """ - :keyword name: Secret Name. + :keyword name: The header field name. Required. :paramtype name: str - :keyword value: Secret Value. + :keyword value: The header field value. Required. :paramtype value: str """ super().__init__(**kwargs) @@ -8849,87 +13729,38 @@ def __init__(self, *, name: Optional[str] = None, value: Optional[str] = None, * self.value = value -class SessionPoolUpdatableProperties(_serialization.Model): - """Container App session pool updatable properties. +class SessionProbeTcpSocket(_serialization.Model): + """TCPSocket specifies an action involving a TCP port. TCP hooks not yet supported. - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar identity: Managed identities needed by a session pool to interact with other Azure - services to not maintain any secrets or credentials in code. - :vartype identity: ~azure.mgmt.appcontainers.models.ManagedServiceIdentity - :ivar scale_configuration: The scale configuration of the session pool. - :vartype scale_configuration: ~azure.mgmt.appcontainers.models.ScaleConfiguration - :ivar secrets: The secrets of the session pool. - :vartype secrets: list[~azure.mgmt.appcontainers.models.SessionPoolSecret] - :ivar dynamic_pool_configuration: The pool configuration if the poolManagementType is dynamic. - :vartype dynamic_pool_configuration: ~azure.mgmt.appcontainers.models.DynamicPoolConfiguration - :ivar custom_container_template: The custom container configuration if the containerType is - CustomContainer. - :vartype custom_container_template: ~azure.mgmt.appcontainers.models.CustomContainerTemplate - :ivar session_network_configuration: The network configuration of the sessions in the session - pool. - :vartype session_network_configuration: - ~azure.mgmt.appcontainers.models.SessionNetworkConfiguration + All required parameters must be populated in order to send to server. + + :ivar host: Optional: Host name to connect to, defaults to the pod IP. + :vartype host: str + :ivar port: Number or name of the port to access on the container. Number must be in the range + 1 to 65535. Name must be an IANA_SVC_NAME. Required. + :vartype port: int """ + _validation = { + "port": {"required": True}, + } + _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, - "scale_configuration": {"key": "properties.scaleConfiguration", "type": "ScaleConfiguration"}, - "secrets": {"key": "properties.secrets", "type": "[SessionPoolSecret]"}, - "dynamic_pool_configuration": { - "key": "properties.dynamicPoolConfiguration", - "type": "DynamicPoolConfiguration", - }, - "custom_container_template": {"key": "properties.customContainerTemplate", "type": "CustomContainerTemplate"}, - "session_network_configuration": { - "key": "properties.sessionNetworkConfiguration", - "type": "SessionNetworkConfiguration", - }, + "host": {"key": "host", "type": "str"}, + "port": {"key": "port", "type": "int"}, } - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - identity: Optional["_models.ManagedServiceIdentity"] = None, - scale_configuration: Optional["_models.ScaleConfiguration"] = None, - secrets: Optional[List["_models.SessionPoolSecret"]] = None, - dynamic_pool_configuration: Optional["_models.DynamicPoolConfiguration"] = None, - custom_container_template: Optional["_models.CustomContainerTemplate"] = None, - session_network_configuration: Optional["_models.SessionNetworkConfiguration"] = None, - **kwargs: Any - ) -> None: + def __init__(self, *, port: int, host: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword identity: Managed identities needed by a session pool to interact with other Azure - services to not maintain any secrets or credentials in code. - :paramtype identity: ~azure.mgmt.appcontainers.models.ManagedServiceIdentity - :keyword scale_configuration: The scale configuration of the session pool. - :paramtype scale_configuration: ~azure.mgmt.appcontainers.models.ScaleConfiguration - :keyword secrets: The secrets of the session pool. - :paramtype secrets: list[~azure.mgmt.appcontainers.models.SessionPoolSecret] - :keyword dynamic_pool_configuration: The pool configuration if the poolManagementType is - dynamic. - :paramtype dynamic_pool_configuration: - ~azure.mgmt.appcontainers.models.DynamicPoolConfiguration - :keyword custom_container_template: The custom container configuration if the containerType is - CustomContainer. - :paramtype custom_container_template: ~azure.mgmt.appcontainers.models.CustomContainerTemplate - :keyword session_network_configuration: The network configuration of the sessions in the - session pool. - :paramtype session_network_configuration: - ~azure.mgmt.appcontainers.models.SessionNetworkConfiguration + :keyword host: Optional: Host name to connect to, defaults to the pod IP. + :paramtype host: str + :keyword port: Number or name of the port to access on the container. Number must be in the + range 1 to 65535. Name must be an IANA_SVC_NAME. Required. + :paramtype port: int """ super().__init__(**kwargs) - self.tags = tags - self.identity = identity - self.scale_configuration = scale_configuration - self.secrets = secrets - self.dynamic_pool_configuration = dynamic_pool_configuration - self.custom_container_template = custom_container_template - self.session_network_configuration = session_network_configuration + self.host = host + self.port = port class SessionRegistryCredentials(_serialization.Model): @@ -8964,22 +13795,82 @@ def __init__( **kwargs: Any ) -> None: """ - :keyword server: Container registry server. - :paramtype server: str - :keyword username: Container registry username. + :keyword server: Container registry server. + :paramtype server: str + :keyword username: Container registry username. + :paramtype username: str + :keyword password_secret_ref: The name of the secret that contains the registry login password. + :paramtype password_secret_ref: str + :keyword identity: A Managed Identity to use to authenticate with Azure Container Registry. For + user-assigned identities, use the full user-assigned identity Resource ID. For system-assigned + identities, use 'system'. + :paramtype identity: str + """ + super().__init__(**kwargs) + self.server = server + self.username = username + self.password_secret_ref = password_secret_ref + self.identity = identity + + +class SmbStorage(_serialization.Model): + """SMB storage properties. + + :ivar host: The host name or IP address of the SMB server. + :vartype host: str + :ivar share_name: The path to the SMB shared folder. + :vartype share_name: str + :ivar username: The user to log on to the SMB server. + :vartype username: str + :ivar domain: The domain name for the user. + :vartype domain: str + :ivar password: The password for the user. + :vartype password: str + :ivar access_mode: Access mode for storage. Known values are: "ReadOnly" and "ReadWrite". + :vartype access_mode: str or ~azure.mgmt.appcontainers.models.AccessMode + """ + + _attribute_map = { + "host": {"key": "host", "type": "str"}, + "share_name": {"key": "shareName", "type": "str"}, + "username": {"key": "username", "type": "str"}, + "domain": {"key": "domain", "type": "str"}, + "password": {"key": "password", "type": "str"}, + "access_mode": {"key": "accessMode", "type": "str"}, + } + + def __init__( + self, + *, + host: Optional[str] = None, + share_name: Optional[str] = None, + username: Optional[str] = None, + domain: Optional[str] = None, + password: Optional[str] = None, + access_mode: Optional[Union[str, "_models.AccessMode"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword host: The host name or IP address of the SMB server. + :paramtype host: str + :keyword share_name: The path to the SMB shared folder. + :paramtype share_name: str + :keyword username: The user to log on to the SMB server. :paramtype username: str - :keyword password_secret_ref: The name of the secret that contains the registry login password. - :paramtype password_secret_ref: str - :keyword identity: A Managed Identity to use to authenticate with Azure Container Registry. For - user-assigned identities, use the full user-assigned identity Resource ID. For system-assigned - identities, use 'system'. - :paramtype identity: str + :keyword domain: The domain name for the user. + :paramtype domain: str + :keyword password: The password for the user. + :paramtype password: str + :keyword access_mode: Access mode for storage. Known values are: "ReadOnly" and "ReadWrite". + :paramtype access_mode: str or ~azure.mgmt.appcontainers.models.AccessMode """ super().__init__(**kwargs) - self.server = server + self.host = host + self.share_name = share_name self.username = username - self.password_secret_ref = password_secret_ref - self.identity = identity + self.domain = domain + self.password = password + self.access_mode = access_mode class SourceControl(ProxyResource): @@ -8988,7 +13879,7 @@ class SourceControl(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -9056,7 +13947,7 @@ def __init__( ~azure.mgmt.appcontainers.models.GithubActionConfiguration """ super().__init__(**kwargs) - self.operation_state = None + self.operation_state: Optional[Union[str, "_models.SourceControlOperationState"]] = None self.repo_url = repo_url self.branch = branch self.github_action_configuration = github_action_configuration @@ -9092,7 +13983,7 @@ def __init__(self, *, value: List["_models.SourceControl"], **kwargs: Any) -> No """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class SpringBootAdminComponent(JavaComponentProperties): @@ -9103,7 +13994,7 @@ class SpringBootAdminComponent(JavaComponentProperties): All required parameters must be populated in order to send to server. :ivar component_type: Type of the Java Component. Required. Known values are: - "SpringBootAdmin", "SpringCloudEureka", and "SpringCloudConfig". + "SpringBootAdmin", "SpringCloudEureka", "SpringCloudConfig", "SpringCloudGateway", and "Nacos". :vartype component_type: str or ~azure.mgmt.appcontainers.models.JavaComponentType :ivar provisioning_state: Provisioning state of the Java Component. Known values are: "Succeeded", "Failed", "Canceled", "Deleting", and "InProgress". @@ -9167,7 +14058,7 @@ class SpringCloudConfigComponent(JavaComponentProperties): All required parameters must be populated in order to send to server. :ivar component_type: Type of the Java Component. Required. Known values are: - "SpringBootAdmin", "SpringCloudEureka", and "SpringCloudConfig". + "SpringBootAdmin", "SpringCloudEureka", "SpringCloudConfig", "SpringCloudGateway", and "Nacos". :vartype component_type: str or ~azure.mgmt.appcontainers.models.JavaComponentType :ivar provisioning_state: Provisioning state of the Java Component. Known values are: "Succeeded", "Failed", "Canceled", "Deleting", and "InProgress". @@ -9224,7 +14115,7 @@ class SpringCloudEurekaComponent(JavaComponentProperties): All required parameters must be populated in order to send to server. :ivar component_type: Type of the Java Component. Required. Known values are: - "SpringBootAdmin", "SpringCloudEureka", and "SpringCloudConfig". + "SpringBootAdmin", "SpringCloudEureka", "SpringCloudConfig", "SpringCloudGateway", and "Nacos". :vartype component_type: str or ~azure.mgmt.appcontainers.models.JavaComponentType :ivar provisioning_state: Provisioning state of the Java Component. Known values are: "Succeeded", "Failed", "Canceled", "Deleting", and "InProgress". @@ -9280,6 +14171,77 @@ def __init__( self.ingress = ingress +class SpringCloudGatewayComponent(JavaComponentProperties): + """Spring Cloud Gateway properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar component_type: Type of the Java Component. Required. Known values are: + "SpringBootAdmin", "SpringCloudEureka", "SpringCloudConfig", "SpringCloudGateway", and "Nacos". + :vartype component_type: str or ~azure.mgmt.appcontainers.models.JavaComponentType + :ivar provisioning_state: Provisioning state of the Java Component. Known values are: + "Succeeded", "Failed", "Canceled", "Deleting", and "InProgress". + :vartype provisioning_state: str or + ~azure.mgmt.appcontainers.models.JavaComponentProvisioningState + :ivar configurations: List of Java Components configuration properties. + :vartype configurations: + list[~azure.mgmt.appcontainers.models.JavaComponentConfigurationProperty] + :ivar scale: Java component scaling configurations. + :vartype scale: ~azure.mgmt.appcontainers.models.JavaComponentPropertiesScale + :ivar service_binds: List of Java Components that are bound to the Java component. + :vartype service_binds: list[~azure.mgmt.appcontainers.models.JavaComponentServiceBind] + :ivar ingress: Java Component Ingress configurations. + :vartype ingress: ~azure.mgmt.appcontainers.models.JavaComponentIngress + :ivar spring_cloud_gateway_routes: Gateway route definition. + :vartype spring_cloud_gateway_routes: list[~azure.mgmt.appcontainers.models.ScgRoute] + """ + + _validation = { + "component_type": {"required": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "component_type": {"key": "componentType", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "configurations": {"key": "configurations", "type": "[JavaComponentConfigurationProperty]"}, + "scale": {"key": "scale", "type": "JavaComponentPropertiesScale"}, + "service_binds": {"key": "serviceBinds", "type": "[JavaComponentServiceBind]"}, + "ingress": {"key": "ingress", "type": "JavaComponentIngress"}, + "spring_cloud_gateway_routes": {"key": "springCloudGatewayRoutes", "type": "[ScgRoute]"}, + } + + def __init__( + self, + *, + configurations: Optional[List["_models.JavaComponentConfigurationProperty"]] = None, + scale: Optional["_models.JavaComponentPropertiesScale"] = None, + service_binds: Optional[List["_models.JavaComponentServiceBind"]] = None, + ingress: Optional["_models.JavaComponentIngress"] = None, + spring_cloud_gateway_routes: Optional[List["_models.ScgRoute"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword configurations: List of Java Components configuration properties. + :paramtype configurations: + list[~azure.mgmt.appcontainers.models.JavaComponentConfigurationProperty] + :keyword scale: Java component scaling configurations. + :paramtype scale: ~azure.mgmt.appcontainers.models.JavaComponentPropertiesScale + :keyword service_binds: List of Java Components that are bound to the Java component. + :paramtype service_binds: list[~azure.mgmt.appcontainers.models.JavaComponentServiceBind] + :keyword ingress: Java Component Ingress configurations. + :paramtype ingress: ~azure.mgmt.appcontainers.models.JavaComponentIngress + :keyword spring_cloud_gateway_routes: Gateway route definition. + :paramtype spring_cloud_gateway_routes: list[~azure.mgmt.appcontainers.models.ScgRoute] + """ + super().__init__(configurations=configurations, scale=scale, service_binds=service_binds, **kwargs) + self.component_type: str = "SpringCloudGateway" + self.ingress = ingress + self.spring_cloud_gateway_routes = spring_cloud_gateway_routes + + class SystemData(_serialization.Model): """Metadata pertaining to creation and last modification of the resource. @@ -9344,6 +14306,46 @@ def __init__( self.last_modified_at = last_modified_at +class TcpConnectionPool(_serialization.Model): + """Defines parameters for tcp connection pooling. + + :ivar max_connections: Maximum number of tcp connections allowed. + :vartype max_connections: int + """ + + _attribute_map = { + "max_connections": {"key": "maxConnections", "type": "int"}, + } + + def __init__(self, *, max_connections: Optional[int] = None, **kwargs: Any) -> None: + """ + :keyword max_connections: Maximum number of tcp connections allowed. + :paramtype max_connections: int + """ + super().__init__(**kwargs) + self.max_connections = max_connections + + +class TcpRetryPolicy(_serialization.Model): + """Policy that defines tcp request retry conditions. + + :ivar max_connect_attempts: Maximum number of attempts to connect to the tcp service. + :vartype max_connect_attempts: int + """ + + _attribute_map = { + "max_connect_attempts": {"key": "maxConnectAttempts", "type": "int"}, + } + + def __init__(self, *, max_connect_attempts: Optional[int] = None, **kwargs: Any) -> None: + """ + :keyword max_connect_attempts: Maximum number of attempts to connect to the tcp service. + :paramtype max_connect_attempts: int + """ + super().__init__(**kwargs) + self.max_connect_attempts = max_connect_attempts + + class TcpScaleRule(_serialization.Model): """Container App container Tcp scaling rule. @@ -9462,6 +14464,40 @@ def __init__( self.service_binds = service_binds +class TimeoutPolicy(_serialization.Model): + """Policy to set request timeouts. + + :ivar response_timeout_in_seconds: Timeout, in seconds, for a request to respond. + :vartype response_timeout_in_seconds: int + :ivar connection_timeout_in_seconds: Timeout, in seconds, for a request to initiate a + connection. + :vartype connection_timeout_in_seconds: int + """ + + _attribute_map = { + "response_timeout_in_seconds": {"key": "responseTimeoutInSeconds", "type": "int"}, + "connection_timeout_in_seconds": {"key": "connectionTimeoutInSeconds", "type": "int"}, + } + + def __init__( + self, + *, + response_timeout_in_seconds: Optional[int] = None, + connection_timeout_in_seconds: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword response_timeout_in_seconds: Timeout, in seconds, for a request to respond. + :paramtype response_timeout_in_seconds: int + :keyword connection_timeout_in_seconds: Timeout, in seconds, for a request to initiate a + connection. + :paramtype connection_timeout_in_seconds: int + """ + super().__init__(**kwargs) + self.response_timeout_in_seconds = response_timeout_in_seconds + self.connection_timeout_in_seconds = connection_timeout_in_seconds + + class TokenStore(_serialization.Model): """The configuration settings of the token store. @@ -9511,6 +14547,34 @@ def __init__( self.azure_blob_storage = azure_blob_storage +class TracesConfiguration(_serialization.Model): + """Configuration of Open Telemetry traces. + + :ivar include_dapr: Boolean indicating if including dapr traces. + :vartype include_dapr: bool + :ivar destinations: Open telemetry traces destinations. + :vartype destinations: list[str] + """ + + _attribute_map = { + "include_dapr": {"key": "includeDapr", "type": "bool"}, + "destinations": {"key": "destinations", "type": "[str]"}, + } + + def __init__( + self, *, include_dapr: Optional[bool] = None, destinations: Optional[List[str]] = None, **kwargs: Any + ) -> None: + """ + :keyword include_dapr: Boolean indicating if including dapr traces. + :paramtype include_dapr: bool + :keyword destinations: Open telemetry traces destinations. + :paramtype destinations: list[str] + """ + super().__init__(**kwargs) + self.include_dapr = include_dapr + self.destinations = destinations + + class TrafficWeight(_serialization.Model): """Traffic weight assigned to a revision. @@ -9729,8 +14793,8 @@ class UserAssignedIdentity(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.principal_id = None - self.client_id = None + self.principal_id: Optional[str] = None + self.client_id: Optional[str] = None class VnetConfiguration(_serialization.Model): @@ -9804,7 +14868,7 @@ class Volume(_serialization.Model): :ivar name: Volume name. :vartype name: str :ivar storage_type: Storage type for the volume. If not provided, use EmptyDir. Known values - are: "AzureFile", "EmptyDir", "Secret", and "NfsAzureFile". + are: "AzureFile", "EmptyDir", "Secret", "NfsAzureFile", and "Smb". :vartype storage_type: str or ~azure.mgmt.appcontainers.models.StorageType :ivar storage_name: Name of storage resource. No need to provide for EmptyDir and Secret. :vartype storage_name: str @@ -9838,7 +14902,7 @@ def __init__( :keyword name: Volume name. :paramtype name: str :keyword storage_type: Storage type for the volume. If not provided, use EmptyDir. Known values - are: "AzureFile", "EmptyDir", "Secret", and "NfsAzureFile". + are: "AzureFile", "EmptyDir", "Secret", "NfsAzureFile", and "Smb". :paramtype storage_type: str or ~azure.mgmt.appcontainers.models.StorageType :keyword storage_name: Name of storage resource. No need to provide for EmptyDir and Secret. :paramtype storage_name: str @@ -9900,6 +14964,218 @@ def __init__( self.sub_path = sub_path +class WorkflowArtifacts(_serialization.Model): + """The workflow filter. + + :ivar app_settings: Application settings of the workflow. + :vartype app_settings: JSON + :ivar files: Files of the app. + :vartype files: JSON + :ivar files_to_delete: Files of the app to delete. + :vartype files_to_delete: list[str] + """ + + _attribute_map = { + "app_settings": {"key": "appSettings", "type": "object"}, + "files": {"key": "files", "type": "object"}, + "files_to_delete": {"key": "filesToDelete", "type": "[str]"}, + } + + def __init__( + self, + *, + app_settings: Optional[JSON] = None, + files: Optional[JSON] = None, + files_to_delete: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword app_settings: Application settings of the workflow. + :paramtype app_settings: JSON + :keyword files: Files of the app. + :paramtype files: JSON + :keyword files_to_delete: Files of the app to delete. + :paramtype files_to_delete: list[str] + """ + super().__init__(**kwargs) + self.app_settings = app_settings + self.files = files + self.files_to_delete = files_to_delete + + +class WorkflowEnvelope(_serialization.Model): + """Workflow properties definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The resource id. + :vartype id: str + :ivar name: Gets the resource name. + :vartype name: str + :ivar type: Gets the resource type. + :vartype type: str + :ivar kind: The resource kind. + :vartype kind: str + :ivar location: The resource location. + :vartype location: str + :ivar properties: Additional workflow properties. + :vartype properties: ~azure.mgmt.appcontainers.models.WorkflowEnvelopeProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "kind": {"key": "kind", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "properties": {"key": "properties", "type": "WorkflowEnvelopeProperties"}, + } + + def __init__( + self, + *, + kind: Optional[str] = None, + location: Optional[str] = None, + properties: Optional["_models.WorkflowEnvelopeProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword kind: The resource kind. + :paramtype kind: str + :keyword location: The resource location. + :paramtype location: str + :keyword properties: Additional workflow properties. + :paramtype properties: ~azure.mgmt.appcontainers.models.WorkflowEnvelopeProperties + """ + super().__init__(**kwargs) + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None + self.kind = kind + self.location = location + self.properties = properties + + +class WorkflowEnvelopeCollection(_serialization.Model): + """Collection of workflow information elements. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar value: Collection of resources. Required. + :vartype value: list[~azure.mgmt.appcontainers.models.WorkflowEnvelope] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[WorkflowEnvelope]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.WorkflowEnvelope"], **kwargs: Any) -> None: + """ + :keyword value: Collection of resources. Required. + :paramtype value: list[~azure.mgmt.appcontainers.models.WorkflowEnvelope] + """ + super().__init__(**kwargs) + self.value = value + self.next_link: Optional[str] = None + + +class WorkflowEnvelopeProperties(_serialization.Model): + """Additional workflow properties. + + :ivar files: Gets or sets the files. + :vartype files: JSON + :ivar flow_state: Gets or sets the state of the workflow. Known values are: "NotSpecified", + "Completed", "Enabled", "Disabled", "Deleted", and "Suspended". + :vartype flow_state: str or ~azure.mgmt.appcontainers.models.WorkflowState + :ivar health: Gets or sets workflow health. + :vartype health: ~azure.mgmt.appcontainers.models.WorkflowHealth + """ + + _attribute_map = { + "files": {"key": "files", "type": "object"}, + "flow_state": {"key": "flowState", "type": "str"}, + "health": {"key": "health", "type": "WorkflowHealth"}, + } + + def __init__( + self, + *, + files: Optional[JSON] = None, + flow_state: Optional[Union[str, "_models.WorkflowState"]] = None, + health: Optional["_models.WorkflowHealth"] = None, + **kwargs: Any + ) -> None: + """ + :keyword files: Gets or sets the files. + :paramtype files: JSON + :keyword flow_state: Gets or sets the state of the workflow. Known values are: "NotSpecified", + "Completed", "Enabled", "Disabled", "Deleted", and "Suspended". + :paramtype flow_state: str or ~azure.mgmt.appcontainers.models.WorkflowState + :keyword health: Gets or sets workflow health. + :paramtype health: ~azure.mgmt.appcontainers.models.WorkflowHealth + """ + super().__init__(**kwargs) + self.files = files + self.flow_state = flow_state + self.health = health + + +class WorkflowHealth(_serialization.Model): + """Represents the workflow health. + + All required parameters must be populated in order to send to server. + + :ivar state: Gets or sets the workflow health state. Required. Known values are: + "NotSpecified", "Healthy", "Unhealthy", and "Unknown". + :vartype state: str or ~azure.mgmt.appcontainers.models.WorkflowHealthState + :ivar error: Gets or sets the workflow error. + :vartype error: ~azure.mgmt.appcontainers.models.ErrorEntity + """ + + _validation = { + "state": {"required": True}, + } + + _attribute_map = { + "state": {"key": "state", "type": "str"}, + "error": {"key": "error", "type": "ErrorEntity"}, + } + + def __init__( + self, + *, + state: Union[str, "_models.WorkflowHealthState"], + error: Optional["_models.ErrorEntity"] = None, + **kwargs: Any + ) -> None: + """ + :keyword state: Gets or sets the workflow health state. Required. Known values are: + "NotSpecified", "Healthy", "Unhealthy", and "Unknown". + :paramtype state: str or ~azure.mgmt.appcontainers.models.WorkflowHealthState + :keyword error: Gets or sets the workflow error. + :paramtype error: ~azure.mgmt.appcontainers.models.ErrorEntity + """ + super().__init__(**kwargs) + self.state = state + self.error = error + + class WorkloadProfile(_serialization.Model): """Workload profile to scope container app execution. @@ -9907,6 +15183,9 @@ class WorkloadProfile(_serialization.Model): :ivar name: Workload profile type for the workloads to run on. Required. :vartype name: str + :ivar enable_fips: Whether to use a FIPS-enabled OS. Supported only for dedicated workload + profiles. + :vartype enable_fips: bool :ivar workload_profile_type: Workload profile type for the workloads to run on. Required. :vartype workload_profile_type: str :ivar minimum_count: The minimum capacity. @@ -9922,6 +15201,7 @@ class WorkloadProfile(_serialization.Model): _attribute_map = { "name": {"key": "name", "type": "str"}, + "enable_fips": {"key": "enableFips", "type": "bool"}, "workload_profile_type": {"key": "workloadProfileType", "type": "str"}, "minimum_count": {"key": "minimumCount", "type": "int"}, "maximum_count": {"key": "maximumCount", "type": "int"}, @@ -9932,6 +15212,7 @@ def __init__( *, name: str, workload_profile_type: str, + enable_fips: bool = False, minimum_count: Optional[int] = None, maximum_count: Optional[int] = None, **kwargs: Any @@ -9939,6 +15220,9 @@ def __init__( """ :keyword name: Workload profile type for the workloads to run on. Required. :paramtype name: str + :keyword enable_fips: Whether to use a FIPS-enabled OS. Supported only for dedicated workload + profiles. + :paramtype enable_fips: bool :keyword workload_profile_type: Workload profile type for the workloads to run on. Required. :paramtype workload_profile_type: str :keyword minimum_count: The minimum capacity. @@ -9948,6 +15232,7 @@ def __init__( """ super().__init__(**kwargs) self.name = name + self.enable_fips = enable_fips self.workload_profile_type = workload_profile_type self.minimum_count = minimum_count self.maximum_count = maximum_count @@ -9959,7 +15244,7 @@ class WorkloadProfileStates(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -10029,7 +15314,7 @@ def __init__(self, *, value: List["_models.WorkloadProfileStates"], **kwargs: An """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class WorkloadProfileStatesProperties(_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 dd207f7d68b8..7ae6a62ff715 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -12,29 +13,47 @@ if TYPE_CHECKING: from ._patch import * # pylint: disable=unused-wildcard-import +from ._app_resiliency_operations import AppResiliencyOperations # type: ignore from ._container_apps_auth_configs_operations import ContainerAppsAuthConfigsOperations # type: ignore from ._available_workload_profiles_operations import AvailableWorkloadProfilesOperations # type: ignore from ._billing_meters_operations import BillingMetersOperations # type: ignore +from ._builders_operations import BuildersOperations # type: ignore +from ._builds_by_builder_resource_operations import BuildsByBuilderResourceOperations # type: ignore +from ._builds_operations import BuildsOperations # type: ignore +from ._build_auth_token_operations import BuildAuthTokenOperations # type: ignore from ._connected_environments_operations import ConnectedEnvironmentsOperations # type: ignore from ._connected_environments_certificates_operations import ConnectedEnvironmentsCertificatesOperations # type: ignore from ._connected_environments_dapr_components_operations import ConnectedEnvironmentsDaprComponentsOperations # type: ignore from ._connected_environments_storages_operations import ConnectedEnvironmentsStoragesOperations # type: ignore from ._container_apps_operations import ContainerAppsOperations # type: ignore +from ._container_apps_builds_by_container_app_operations import ContainerAppsBuildsByContainerAppOperations # type: ignore +from ._container_apps_builds_operations import ContainerAppsBuildsOperations # type: ignore +from ._container_apps_label_history_operations import ContainerAppsLabelHistoryOperations # type: ignore +from ._container_apps_patches_operations import ContainerAppsPatchesOperations # type: ignore from ._container_apps_revisions_operations import ContainerAppsRevisionsOperations # type: ignore from ._container_apps_revision_replicas_operations import ContainerAppsRevisionReplicasOperations # type: ignore from ._container_apps_diagnostics_operations import ContainerAppsDiagnosticsOperations # type: ignore from ._managed_environment_diagnostics_operations import ManagedEnvironmentDiagnosticsOperations # type: ignore from ._managed_environments_diagnostics_operations import ManagedEnvironmentsDiagnosticsOperations # type: ignore from ._jobs_operations import JobsOperations # type: ignore +from ._dot_net_components_operations import DotNetComponentsOperations # type: ignore +from ._functions_extension_operations import FunctionsExtensionOperations # type: ignore from ._operations import Operations # type: ignore from ._java_components_operations import JavaComponentsOperations # type: ignore from ._jobs_executions_operations import JobsExecutionsOperations # type: ignore from ._container_apps_api_client_operations import ContainerAppsAPIClientOperationsMixin # type: ignore +from ._logic_apps_operations import LogicAppsOperations # type: ignore from ._managed_environments_operations import ManagedEnvironmentsOperations # type: ignore from ._certificates_operations import CertificatesOperations # type: ignore from ._managed_certificates_operations import ManagedCertificatesOperations # type: ignore from ._namespaces_operations import NamespacesOperations # type: ignore +from ._managed_environment_private_endpoint_connections_operations import ManagedEnvironmentPrivateEndpointConnectionsOperations # type: ignore +from ._managed_environment_private_link_resources_operations import ManagedEnvironmentPrivateLinkResourcesOperations # type: ignore +from ._dapr_component_resiliency_policies_operations import DaprComponentResiliencyPoliciesOperations # type: ignore from ._dapr_components_operations import DaprComponentsOperations # type: ignore +from ._dapr_subscriptions_operations import DaprSubscriptionsOperations # type: ignore +from ._http_route_config_operations import HttpRouteConfigOperations # type: ignore +from ._maintenance_configurations_operations import MaintenanceConfigurationsOperations # type: ignore from ._managed_environments_storages_operations import ManagedEnvironmentsStoragesOperations # type: ignore from ._container_apps_session_pools_operations import ContainerAppsSessionPoolsOperations # type: ignore from ._container_apps_source_controls_operations import ContainerAppsSourceControlsOperations # type: ignore @@ -46,29 +65,47 @@ from ._patch import patch_sdk as _patch_sdk __all__ = [ + "AppResiliencyOperations", "ContainerAppsAuthConfigsOperations", "AvailableWorkloadProfilesOperations", "BillingMetersOperations", + "BuildersOperations", + "BuildsByBuilderResourceOperations", + "BuildsOperations", + "BuildAuthTokenOperations", "ConnectedEnvironmentsOperations", "ConnectedEnvironmentsCertificatesOperations", "ConnectedEnvironmentsDaprComponentsOperations", "ConnectedEnvironmentsStoragesOperations", "ContainerAppsOperations", + "ContainerAppsBuildsByContainerAppOperations", + "ContainerAppsBuildsOperations", + "ContainerAppsLabelHistoryOperations", + "ContainerAppsPatchesOperations", "ContainerAppsRevisionsOperations", "ContainerAppsRevisionReplicasOperations", "ContainerAppsDiagnosticsOperations", "ManagedEnvironmentDiagnosticsOperations", "ManagedEnvironmentsDiagnosticsOperations", "JobsOperations", + "DotNetComponentsOperations", + "FunctionsExtensionOperations", "Operations", "JavaComponentsOperations", "JobsExecutionsOperations", "ContainerAppsAPIClientOperationsMixin", + "LogicAppsOperations", "ManagedEnvironmentsOperations", "CertificatesOperations", "ManagedCertificatesOperations", "NamespacesOperations", + "ManagedEnvironmentPrivateEndpointConnectionsOperations", + "ManagedEnvironmentPrivateLinkResourcesOperations", + "DaprComponentResiliencyPoliciesOperations", "DaprComponentsOperations", + "DaprSubscriptionsOperations", + "HttpRouteConfigOperations", + "MaintenanceConfigurationsOperations", "ManagedEnvironmentsStoragesOperations", "ContainerAppsSessionPoolsOperations", "ContainerAppsSourceControlsOperations", diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_app_resiliency_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_app_resiliency_operations.py new file mode 100644 index 000000000000..c70e1e97758b --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_app_resiliency_operations.py @@ -0,0 +1,729 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 collections.abc import MutableMapping +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core import PipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._configuration import ContainerAppsAPIClientConfiguration +from .._serialization import Deserializer, Serializer + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_create_or_update_request( + resource_group_name: str, app_name: str, name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{appName}/resiliencyPolicies/{name}", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "appName": _SERIALIZER.url("app_name", app_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "name": _SERIALIZER.url("name", name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request( + resource_group_name: str, app_name: str, name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{appName}/resiliencyPolicies/{name}", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "appName": _SERIALIZER.url("app_name", app_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "name": _SERIALIZER.url("name", name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, app_name: str, name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{appName}/resiliencyPolicies/{name}", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "appName": _SERIALIZER.url("app_name", app_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "name": _SERIALIZER.url("name", name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, app_name: str, name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{appName}/resiliencyPolicies/{name}", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "appName": _SERIALIZER.url("app_name", app_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "name": _SERIALIZER.url("name", name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_request(resource_group_name: str, app_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{appName}/resiliencyPolicies", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "appName": _SERIALIZER.url("app_name", app_name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class AppResiliencyOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s + :attr:`app_resiliency` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerAppsAPIClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @overload + def create_or_update( + self, + resource_group_name: str, + app_name: str, + name: str, + resiliency_envelope: _models.AppResiliency, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AppResiliency: + """Create or update an application's resiliency policy. + + Create or update container app resiliency policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_name: Name of the Container App. Required. + :type app_name: str + :param name: Name of the resiliency policy. Required. + :type name: str + :param resiliency_envelope: The resiliency policy to create or update. Required. + :type resiliency_envelope: ~azure.mgmt.appcontainers.models.AppResiliency + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: AppResiliency or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.AppResiliency + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + app_name: str, + name: str, + resiliency_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AppResiliency: + """Create or update an application's resiliency policy. + + Create or update container app resiliency policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_name: Name of the Container App. Required. + :type app_name: str + :param name: Name of the resiliency policy. Required. + :type name: str + :param resiliency_envelope: The resiliency policy to create or update. Required. + :type resiliency_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: AppResiliency or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.AppResiliency + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + app_name: str, + name: str, + resiliency_envelope: Union[_models.AppResiliency, IO[bytes]], + **kwargs: Any + ) -> _models.AppResiliency: + """Create or update an application's resiliency policy. + + Create or update container app resiliency policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_name: Name of the Container App. Required. + :type app_name: str + :param name: Name of the resiliency policy. Required. + :type name: str + :param resiliency_envelope: The resiliency policy to create or update. Is either a + AppResiliency type or a IO[bytes] type. Required. + :type resiliency_envelope: ~azure.mgmt.appcontainers.models.AppResiliency or IO[bytes] + :return: AppResiliency or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.AppResiliency + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AppResiliency] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(resiliency_envelope, (IOBase, bytes)): + _content = resiliency_envelope + else: + _json = self._serialize.body(resiliency_envelope, "AppResiliency") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + app_name=app_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AppResiliency", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def update( + self, + resource_group_name: str, + app_name: str, + name: str, + resiliency_envelope: _models.AppResiliency, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AppResiliency: + """Update an application's resiliency policy. + + Update container app resiliency policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_name: Name of the Container App. Required. + :type app_name: str + :param name: Name of the resiliency policy. Required. + :type name: str + :param resiliency_envelope: The resiliency policy to update. Required. + :type resiliency_envelope: ~azure.mgmt.appcontainers.models.AppResiliency + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: AppResiliency or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.AppResiliency + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + app_name: str, + name: str, + resiliency_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AppResiliency: + """Update an application's resiliency policy. + + Update container app resiliency policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_name: Name of the Container App. Required. + :type app_name: str + :param name: Name of the resiliency policy. Required. + :type name: str + :param resiliency_envelope: The resiliency policy to update. Required. + :type resiliency_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: AppResiliency or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.AppResiliency + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + app_name: str, + name: str, + resiliency_envelope: Union[_models.AppResiliency, IO[bytes]], + **kwargs: Any + ) -> _models.AppResiliency: + """Update an application's resiliency policy. + + Update container app resiliency policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_name: Name of the Container App. Required. + :type app_name: str + :param name: Name of the resiliency policy. Required. + :type name: str + :param resiliency_envelope: The resiliency policy to update. Is either a AppResiliency type or + a IO[bytes] type. Required. + :type resiliency_envelope: ~azure.mgmt.appcontainers.models.AppResiliency or IO[bytes] + :return: AppResiliency or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.AppResiliency + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AppResiliency] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(resiliency_envelope, (IOBase, bytes)): + _content = resiliency_envelope + else: + _json = self._serialize.body(resiliency_envelope, "AppResiliency") + + _request = build_update_request( + resource_group_name=resource_group_name, + app_name=app_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AppResiliency", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, app_name: str, name: str, **kwargs: Any + ) -> None: + """Delete an application's resiliency policy. + + Delete container app resiliency policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_name: Name of the Container App. Required. + :type app_name: str + :param name: Name of the resiliency policy. Required. + :type name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + app_name=app_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def get(self, resource_group_name: str, app_name: str, name: str, **kwargs: Any) -> _models.AppResiliency: + """Get an application's resiliency policy. + + Get container app resiliency policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_name: Name of the Container App. Required. + :type app_name: str + :param name: Name of the resiliency policy. Required. + :type name: str + :return: AppResiliency or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.AppResiliency + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AppResiliency] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + app_name=app_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AppResiliency", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list(self, resource_group_name: str, app_name: str, **kwargs: Any) -> Iterable["_models.AppResiliency"]: + """List an application's resiliency policies. + + List container app resiliency policies. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_name: Name of the Container App. Required. + :type app_name: str + :return: An iterator like instance of either AppResiliency or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.AppResiliency] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AppResiliencyCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + app_name=app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("AppResiliencyCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_available_workload_profiles_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_available_workload_profiles_operations.py index e49a9bb9b71f..7c2767f5f030 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,10 +6,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from collections.abc import MutableMapping from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -25,12 +27,9 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._serialization import Serializer +from .._configuration import ContainerAppsAPIClientConfiguration +from .._serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -42,16 +41,16 @@ 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", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.App/locations/{location}/availableManagedEnvironmentsWorkloadProfileTypes", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "location": _SERIALIZER.url("location", location, "str", min_length=1), } @@ -80,10 +79,10 @@ class AvailableWorkloadProfilesOperations: 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") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerAppsAPIClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def get(self, location: str, **kwargs: Any) -> Iterable["_models.AvailableWorkloadProfile"]: 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 5786bbcfb971..9f58d6c14746 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 @@ -5,9 +5,10 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from collections.abc import MutableMapping from typing import Any, Callable, Dict, Optional, TypeVar +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -23,12 +24,9 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._serialization import Serializer +from .._configuration import ContainerAppsAPIClientConfiguration +from .._serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,15 +38,15 @@ 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", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.App/locations/{location}/billingMeters" - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "location": _SERIALIZER.url("location", location, "str", min_length=1), } @@ -77,10 +75,10 @@ class BillingMetersOperations: 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") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerAppsAPIClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def get(self, location: str, **kwargs: Any) -> _models.BillingMeterCollection: diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_build_auth_token_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_build_auth_token_operations.py new file mode 100644 index 000000000000..93a7df64baf6 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_build_auth_token_operations.py @@ -0,0 +1,152 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 collections.abc import MutableMapping +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core import PipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._configuration import ContainerAppsAPIClientConfiguration +from .._serialization import Deserializer, Serializer + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_request( + resource_group_name: str, builder_name: str, build_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}/builds/{buildName}/listAuthToken", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "builderName": _SERIALIZER.url( + "builder_name", builder_name, "str", max_length=32, min_length=2, pattern=r"^[-\w\._\(\)]+$" + ), + "buildName": _SERIALIZER.url( + "build_name", build_name, "str", max_length=64, min_length=2, pattern=r"^[-\w\._\(\)]+$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class BuildAuthTokenOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s + :attr:`build_auth_token` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerAppsAPIClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list(self, resource_group_name: str, builder_name: str, build_name: str, **kwargs: Any) -> _models.BuildToken: + """Gets the token used to connect to the endpoint where source code can be uploaded for a build. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param build_name: The name of a build. Required. + :type build_name: str + :return: BuildToken or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.BuildToken + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BuildToken] = kwargs.pop("cls", None) + + _request = build_list_request( + resource_group_name=resource_group_name, + builder_name=builder_name, + build_name=build_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("BuildToken", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_builders_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_builders_operations.py new file mode 100644 index 000000000000..1e9e41fddcf1 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_builders_operations.py @@ -0,0 +1,978 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 collections.abc import MutableMapping +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core import PipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._configuration import ContainerAppsAPIClientConfiguration +from .._serialization import Deserializer, Serializer + +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", "2025-02-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.App/builders") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request(resource_group_name: str, builder_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "builderName": _SERIALIZER.url( + "builder_name", builder_name, "str", max_length=32, min_length=2, pattern=r"^[-\w\._\(\)]+$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, builder_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-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}", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "builderName": _SERIALIZER.url( + "builder_name", builder_name, "str", max_length=32, min_length=2, pattern=r"^[-\w\._\(\)]+$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request( + resource_group_name: str, builder_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-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}", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "builderName": _SERIALIZER.url( + "builder_name", builder_name, "str", max_length=32, min_length=2, pattern=r"^[-\w\._\(\)]+$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, builder_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "builderName": _SERIALIZER.url( + "builder_name", builder_name, "str", max_length=32, min_length=2, pattern=r"^[-\w\._\(\)]+$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class BuildersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s + :attr:`builders` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerAppsAPIClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.BuilderResource"]: + """List BuilderResource resources by subscription ID. + + :return: An iterator like instance of either BuilderResource or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.BuilderResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BuilderCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("BuilderCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.BuilderResource"]: + """List BuilderResource resources by resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of either BuilderResource or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.BuilderResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BuilderCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("BuilderCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get(self, resource_group_name: str, builder_name: str, **kwargs: Any) -> _models.BuilderResource: + """Get a BuilderResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :return: BuilderResource or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.BuilderResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + builder_name=builder_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("BuilderResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + builder_name: str, + builder_envelope: Union[_models.BuilderResource, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(builder_envelope, (IOBase, bytes)): + _content = builder_envelope + else: + _json = self._serialize.body(builder_envelope, "BuilderResource") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + builder_name=builder_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + builder_name: str, + builder_envelope: _models.BuilderResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.BuilderResource]: + """Create or update a BuilderResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param builder_envelope: Resource create parameters. Required. + :type builder_envelope: ~azure.mgmt.appcontainers.models.BuilderResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either BuilderResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.BuilderResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + builder_name: str, + builder_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.BuilderResource]: + """Create or update a BuilderResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param builder_envelope: Resource create parameters. Required. + :type builder_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either BuilderResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.BuilderResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + builder_name: str, + builder_envelope: Union[_models.BuilderResource, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.BuilderResource]: + """Create or update a BuilderResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param builder_envelope: Resource create parameters. Is either a BuilderResource type or a + IO[bytes] type. Required. + :type builder_envelope: ~azure.mgmt.appcontainers.models.BuilderResource or IO[bytes] + :return: An instance of LROPoller that returns either BuilderResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.BuilderResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + builder_name=builder_name, + builder_envelope=builder_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("BuilderResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.BuilderResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.BuilderResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _update_initial( + self, + resource_group_name: str, + builder_name: str, + builder_envelope: Union[_models.BuilderResourceUpdate, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(builder_envelope, (IOBase, bytes)): + _content = builder_envelope + else: + _json = self._serialize.body(builder_envelope, "BuilderResourceUpdate") + + _request = build_update_request( + resource_group_name=resource_group_name, + builder_name=builder_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + builder_name: str, + builder_envelope: _models.BuilderResourceUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.BuilderResource]: + """Update a BuilderResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param builder_envelope: The resource properties to be updated. Required. + :type builder_envelope: ~azure.mgmt.appcontainers.models.BuilderResourceUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either BuilderResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.BuilderResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + builder_name: str, + builder_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.BuilderResource]: + """Update a BuilderResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param builder_envelope: The resource properties to be updated. Required. + :type builder_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either BuilderResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.BuilderResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + builder_name: str, + builder_envelope: Union[_models.BuilderResourceUpdate, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.BuilderResource]: + """Update a BuilderResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param builder_envelope: The resource properties to be updated. Is either a + BuilderResourceUpdate type or a IO[bytes] type. Required. + :type builder_envelope: ~azure.mgmt.appcontainers.models.BuilderResourceUpdate or IO[bytes] + :return: An instance of LROPoller that returns either BuilderResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.BuilderResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + builder_name=builder_name, + builder_envelope=builder_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("BuilderResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.BuilderResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.BuilderResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial(self, resource_group_name: str, builder_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + builder_name=builder_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete(self, resource_group_name: str, builder_name: str, **kwargs: Any) -> LROPoller[None]: + """Delete a BuilderResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + builder_name=builder_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_builds_by_builder_resource_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_builds_by_builder_resource_operations.py new file mode 100644 index 000000000000..52af43333d8f --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_builds_by_builder_resource_operations.py @@ -0,0 +1,172 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 collections.abc import MutableMapping +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import urllib.parse + +from azure.core import PipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._configuration import ContainerAppsAPIClientConfiguration +from .._serialization import Deserializer, Serializer + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_request(resource_group_name: str, builder_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-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", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "builderName": _SERIALIZER.url( + "builder_name", builder_name, "str", max_length=32, min_length=2, pattern=r"^[-\w\._\(\)]+$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class BuildsByBuilderResourceOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s + :attr:`builds_by_builder_resource` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerAppsAPIClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list(self, resource_group_name: str, builder_name: str, **kwargs: Any) -> Iterable["_models.BuildResource"]: + """List BuildResource resources by BuilderResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :return: An iterator like instance of either BuildResource or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.BuildResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BuildCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + builder_name=builder_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("BuildCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_builds_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_builds_operations.py new file mode 100644 index 000000000000..eec1cb7bfa94 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_builds_operations.py @@ -0,0 +1,565 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 collections.abc import MutableMapping +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterator, Optional, TypeVar, Union, cast, overload + +from azure.core import PipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._configuration import ContainerAppsAPIClientConfiguration +from .._serialization import Deserializer, Serializer + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_get_request( + resource_group_name: str, builder_name: str, build_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-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}", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "builderName": _SERIALIZER.url( + "builder_name", builder_name, "str", max_length=32, min_length=2, pattern=r"^[-\w\._\(\)]+$" + ), + "buildName": _SERIALIZER.url( + "build_name", build_name, "str", max_length=64, min_length=2, pattern=r"^[-\w\._\(\)]+$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, builder_name: str, build_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-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}", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "builderName": _SERIALIZER.url( + "builder_name", builder_name, "str", max_length=32, min_length=2, pattern=r"^[-\w\._\(\)]+$" + ), + "buildName": _SERIALIZER.url( + "build_name", build_name, "str", max_length=64, min_length=2, pattern=r"^[-\w\._\(\)]+$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, builder_name: str, build_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-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}", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "builderName": _SERIALIZER.url( + "builder_name", builder_name, "str", max_length=32, min_length=2, pattern=r"^[-\w\._\(\)]+$" + ), + "buildName": _SERIALIZER.url( + "build_name", build_name, "str", max_length=64, min_length=2, pattern=r"^[-\w\._\(\)]+$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class BuildsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s + :attr:`builds` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerAppsAPIClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get(self, resource_group_name: str, builder_name: str, build_name: str, **kwargs: Any) -> _models.BuildResource: + """Get a BuildResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param build_name: The name of a build. Required. + :type build_name: str + :return: BuildResource or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.BuildResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BuildResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + builder_name=builder_name, + build_name=build_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("BuildResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + builder_name: str, + build_name: str, + build_envelope: Union[_models.BuildResource, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(build_envelope, (IOBase, bytes)): + _content = build_envelope + else: + _json = self._serialize.body(build_envelope, "BuildResource") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + builder_name=builder_name, + build_name=build_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + builder_name: str, + build_name: str, + build_envelope: _models.BuildResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.BuildResource]: + """Create a BuildResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param build_name: The name of a build. Required. + :type build_name: str + :param build_envelope: Resource create or update parameters. Required. + :type build_envelope: ~azure.mgmt.appcontainers.models.BuildResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either BuildResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.BuildResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + builder_name: str, + build_name: str, + build_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.BuildResource]: + """Create a BuildResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param build_name: The name of a build. Required. + :type build_name: str + :param build_envelope: Resource create or update parameters. Required. + :type build_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either BuildResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.BuildResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + builder_name: str, + build_name: str, + build_envelope: Union[_models.BuildResource, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.BuildResource]: + """Create a BuildResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param build_name: The name of a build. Required. + :type build_name: str + :param build_envelope: Resource create or update parameters. Is either a BuildResource type or + a IO[bytes] type. Required. + :type build_envelope: ~azure.mgmt.appcontainers.models.BuildResource or IO[bytes] + :return: An instance of LROPoller that returns either BuildResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.BuildResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BuildResource] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + builder_name=builder_name, + build_name=build_name, + build_envelope=build_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("BuildResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.BuildResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.BuildResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, resource_group_name: str, builder_name: str, build_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + builder_name=builder_name, + build_name=build_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, resource_group_name: str, builder_name: str, build_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Delete a BuildResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param build_name: The name of a build. Required. + :type build_name: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + builder_name=builder_name, + build_name=build_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_certificates_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_certificates_operations.py index 965443b7ec4b..7e7c715e4999 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -26,12 +28,9 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._serialization import Serializer +from .._configuration import ContainerAppsAPIClientConfiguration +from .._serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,16 +44,16 @@ 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", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/certificates", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -78,16 +77,16 @@ 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", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/certificates/{certificateName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -112,7 +111,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -120,9 +119,9 @@ def build_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/certificates/{certificateName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -149,16 +148,16 @@ 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", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/certificates/{certificateName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -183,7 +182,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", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -191,9 +190,9 @@ def build_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/certificates/{certificateName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -228,10 +227,10 @@ class CertificatesOperations: 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") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerAppsAPIClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list(self, resource_group_name: str, environment_name: str, **kwargs: Any) -> Iterable["_models.Certificate"]: 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 0dbebff78519..a04eadaaef47 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,33 +6,35 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._serialization import Serializer +from .._configuration import ContainerAppsAPIClientConfiguration +from .._serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,16 +48,16 @@ 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", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/certificates", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -82,16 +85,16 @@ 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", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/certificates/{certificateName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -120,7 +123,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", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -128,9 +131,9 @@ def build_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/certificates/{certificateName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -161,16 +164,16 @@ 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", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/certificates/{certificateName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -199,7 +202,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", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -207,9 +210,9 @@ def build_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/certificates/{certificateName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -244,10 +247,10 @@ class ConnectedEnvironmentsCertificatesOperations: # pylint: disable=name-too-l 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") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerAppsAPIClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list( @@ -398,8 +401,80 @@ def get( return deserialized # type: ignore + def _create_or_update_initial( + self, + resource_group_name: str, + connected_environment_name: str, + certificate_name: str, + certificate_envelope: Optional[Union[_models.Certificate, IO[bytes]]] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(certificate_envelope, (IOBase, bytes)): + _content = certificate_envelope + else: + if certificate_envelope is not None: + _json = self._serialize.body(certificate_envelope, "Certificate") + else: + _json = None + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + connected_environment_name=connected_environment_name, + certificate_name=certificate_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + @overload - def create_or_update( + def begin_create_or_update( self, resource_group_name: str, connected_environment_name: str, @@ -408,7 +483,7 @@ def create_or_update( *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Certificate: + ) -> LROPoller[_models.Certificate]: """Create or Update a Certificate. Create or Update a Certificate. @@ -425,13 +500,14 @@ def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: Certificate or the result of cls(response) - :rtype: ~azure.mgmt.appcontainers.models.Certificate + :return: An instance of LROPoller that returns either Certificate or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.Certificate] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def create_or_update( + def begin_create_or_update( self, resource_group_name: str, connected_environment_name: str, @@ -440,7 +516,7 @@ def create_or_update( *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Certificate: + ) -> LROPoller[_models.Certificate]: """Create or Update a Certificate. Create or Update a Certificate. @@ -457,20 +533,21 @@ def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: Certificate or the result of cls(response) - :rtype: ~azure.mgmt.appcontainers.models.Certificate + :return: An instance of LROPoller that returns either Certificate or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.Certificate] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def create_or_update( + def begin_create_or_update( self, resource_group_name: str, connected_environment_name: str, certificate_name: str, certificate_envelope: Optional[Union[_models.Certificate, IO[bytes]]] = None, **kwargs: Any - ) -> _models.Certificate: + ) -> LROPoller[_models.Certificate]: """Create or Update a Certificate. Create or Update a Certificate. @@ -485,10 +562,64 @@ def create_or_update( :param certificate_envelope: Certificate to be created or updated. Is either a Certificate type or a IO[bytes] type. Default value is None. :type certificate_envelope: ~azure.mgmt.appcontainers.models.Certificate or IO[bytes] - :return: Certificate or the result of cls(response) - :rtype: ~azure.mgmt.appcontainers.models.Certificate + :return: An instance of LROPoller that returns either Certificate or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.Certificate] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Certificate] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + connected_environment_name=connected_environment_name, + certificate_name=certificate_name, + certificate_envelope=certificate_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Certificate", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.Certificate].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.Certificate]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, resource_group_name: str, connected_environment_name: str, certificate_name: str, **kwargs: Any + ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -497,61 +628,55 @@ def create_or_update( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Certificate] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(certificate_envelope, (IOBase, bytes)): - _content = certificate_envelope - else: - if certificate_envelope is not None: - _json = self._serialize.body(certificate_envelope, "Certificate") - else: - _json = None + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_create_or_update_request( + _request = build_delete_request( resource_group_name=resource_group_name, connected_environment_name=connected_environment_name, certificate_name=certificate_name, subscription_id=self._config.subscription_id, api_version=api_version, - content_type=content_type, - json=_json, - content=_content, headers=_headers, params=_params, ) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Certificate", pipeline_response.http_response) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements + def begin_delete( self, resource_group_name: str, connected_environment_name: str, certificate_name: str, **kwargs: Any - ) -> None: + ) -> LROPoller[None]: """Deletes the specified Certificate. Deletes the specified Certificate. @@ -563,10 +688,61 @@ def delete( # pylint: disable=inconsistent-return-statements :type connected_environment_name: str :param certificate_name: Name of the Certificate. Required. :type certificate_name: str - :return: None or the result of cls(response) - :rtype: None + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + connected_environment_name=connected_environment_name, + certificate_name=certificate_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _update_initial( + self, + resource_group_name: str, + connected_environment_name: str, + certificate_name: str, + certificate_envelope: Union[_models.CertificatePatch, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -575,40 +751,65 @@ def delete( # pylint: disable=inconsistent-return-statements } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_delete_request( + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(certificate_envelope, (IOBase, bytes)): + _content = certificate_envelope + else: + _json = self._serialize.body(certificate_envelope, "CertificatePatch") + + _request = build_update_request( resource_group_name=resource_group_name, connected_environment_name=connected_environment_name, certificate_name=certificate_name, subscription_id=self._config.subscription_id, api_version=api_version, + content_type=content_type, + json=_json, + content=_content, headers=_headers, params=_params, ) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 204]: + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @overload - def update( + def begin_update( self, resource_group_name: str, connected_environment_name: str, @@ -617,7 +818,7 @@ def update( *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Certificate: + ) -> LROPoller[_models.Certificate]: """Update properties of a certificate. Patches a certificate. Currently only patching of tags is supported. @@ -634,13 +835,14 @@ def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: Certificate or the result of cls(response) - :rtype: ~azure.mgmt.appcontainers.models.Certificate + :return: An instance of LROPoller that returns either Certificate or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.Certificate] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def update( + def begin_update( self, resource_group_name: str, connected_environment_name: str, @@ -649,7 +851,7 @@ def update( *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Certificate: + ) -> LROPoller[_models.Certificate]: """Update properties of a certificate. Patches a certificate. Currently only patching of tags is supported. @@ -666,20 +868,21 @@ def update( :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: Certificate or the result of cls(response) - :rtype: ~azure.mgmt.appcontainers.models.Certificate + :return: An instance of LROPoller that returns either Certificate or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.Certificate] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def update( + def begin_update( self, resource_group_name: str, connected_environment_name: str, certificate_name: str, certificate_envelope: Union[_models.CertificatePatch, IO[bytes]], **kwargs: Any - ) -> _models.Certificate: + ) -> LROPoller[_models.Certificate]: """Update properties of a certificate. Patches a certificate. Currently only patching of tags is supported. @@ -694,62 +897,57 @@ def update( :param certificate_envelope: Properties of a certificate that need to be updated. Is either a CertificatePatch type or a IO[bytes] type. Required. :type certificate_envelope: ~azure.mgmt.appcontainers.models.CertificatePatch or IO[bytes] - :return: Certificate or the result of cls(response) - :rtype: ~azure.mgmt.appcontainers.models.Certificate + :return: An instance of LROPoller that returns either Certificate or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.Certificate] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Certificate] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + connected_environment_name=connected_environment_name, + certificate_name=certificate_name, + certificate_envelope=certificate_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(certificate_envelope, (IOBase, bytes)): - _content = certificate_envelope - else: - _json = self._serialize.body(certificate_envelope, "CertificatePatch") - - _request = build_update_request( - resource_group_name=resource_group_name, - connected_environment_name=connected_environment_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Certificate", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.Certificate].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.Certificate]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Certificate", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_connected_environments_dapr_components_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_connected_environments_dapr_components_operations.py index b860c6319e75..1dd26d1e2202 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,33 +6,35 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._serialization import Serializer +from .._configuration import ContainerAppsAPIClientConfiguration +from .._serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,16 +48,16 @@ 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", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/daprComponents", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -78,16 +81,16 @@ 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", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/daprComponents/{componentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -112,7 +115,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -120,9 +123,9 @@ def build_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/daprComponents/{componentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -149,16 +152,16 @@ 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", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/daprComponents/{componentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -183,16 +186,16 @@ 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", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/daprComponents/{componentName}/listSecrets", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -225,15 +228,15 @@ class ConnectedEnvironmentsDaprComponentsOperations: # pylint: disable=name-too 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") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerAppsAPIClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list( self, resource_group_name: str, connected_environment_name: str, **kwargs: Any - ) -> Iterable["_models.DaprComponent"]: + ) -> Iterable["_models.ConnectedEnvironmentDaprComponent"]: """Get the Dapr Components for a connected environment. Get the Dapr Components for a connected environment. @@ -243,15 +246,17 @@ def list( :type resource_group_name: str :param connected_environment_name: Name of the connected environment. Required. :type connected_environment_name: str - :return: An iterator like instance of either DaprComponent or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.DaprComponent] + :return: An iterator like instance of either ConnectedEnvironmentDaprComponent or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.ConnectedEnvironmentDaprComponent] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.DaprComponentsCollection] = kwargs.pop("cls", None) + cls: ClsType[_models.ConnectedEnvironmentDaprComponentsCollection] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -292,7 +297,7 @@ def prepare_request(next_link=None): return _request def extract_data(pipeline_response): - deserialized = self._deserialize("DaprComponentsCollection", pipeline_response) + deserialized = self._deserialize("ConnectedEnvironmentDaprComponentsCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -319,7 +324,7 @@ def get_next(next_link=None): @distributed_trace def get( self, resource_group_name: str, connected_environment_name: str, component_name: str, **kwargs: Any - ) -> _models.DaprComponent: + ) -> _models.ConnectedEnvironmentDaprComponent: """Get a dapr component. Get a dapr component. @@ -331,8 +336,8 @@ def get( :type connected_environment_name: str :param component_name: Name of the Dapr Component. Required. :type component_name: str - :return: DaprComponent or the result of cls(response) - :rtype: ~azure.mgmt.appcontainers.models.DaprComponent + :return: ConnectedEnvironmentDaprComponent or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.ConnectedEnvironmentDaprComponent :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -347,7 +352,7 @@ def get( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.DaprComponent] = kwargs.pop("cls", None) + cls: ClsType[_models.ConnectedEnvironmentDaprComponent] = kwargs.pop("cls", None) _request = build_get_request( resource_group_name=resource_group_name, @@ -372,7 +377,76 @@ def get( error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DaprComponent", pipeline_response.http_response) + deserialized = self._deserialize("ConnectedEnvironmentDaprComponent", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + connected_environment_name: str, + component_name: str, + dapr_component_envelope: Union[_models.ConnectedEnvironmentDaprComponent, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(dapr_component_envelope, (IOBase, bytes)): + _content = dapr_component_envelope + else: + _json = self._serialize.body(dapr_component_envelope, "ConnectedEnvironmentDaprComponent") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + connected_environment_name=connected_environment_name, + component_name=component_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -380,16 +454,16 @@ def get( return deserialized # type: ignore @overload - def create_or_update( + def begin_create_or_update( self, resource_group_name: str, connected_environment_name: str, component_name: str, - dapr_component_envelope: _models.DaprComponent, + dapr_component_envelope: _models.ConnectedEnvironmentDaprComponent, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.DaprComponent: + ) -> LROPoller[_models.ConnectedEnvironmentDaprComponent]: """Creates or updates a Dapr Component. Creates or updates a Dapr Component in a connected environment. @@ -402,17 +476,20 @@ def create_or_update( :param component_name: Name of the Dapr Component. Required. :type component_name: str :param dapr_component_envelope: Configuration details of the Dapr Component. Required. - :type dapr_component_envelope: ~azure.mgmt.appcontainers.models.DaprComponent + :type dapr_component_envelope: + ~azure.mgmt.appcontainers.models.ConnectedEnvironmentDaprComponent :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: DaprComponent or the result of cls(response) - :rtype: ~azure.mgmt.appcontainers.models.DaprComponent + :return: An instance of LROPoller that returns either ConnectedEnvironmentDaprComponent or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.ConnectedEnvironmentDaprComponent] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def create_or_update( + def begin_create_or_update( self, resource_group_name: str, connected_environment_name: str, @@ -421,7 +498,7 @@ def create_or_update( *, content_type: str = "application/json", **kwargs: Any - ) -> _models.DaprComponent: + ) -> LROPoller[_models.ConnectedEnvironmentDaprComponent]: """Creates or updates a Dapr Component. Creates or updates a Dapr Component in a connected environment. @@ -438,20 +515,22 @@ def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: DaprComponent or the result of cls(response) - :rtype: ~azure.mgmt.appcontainers.models.DaprComponent + :return: An instance of LROPoller that returns either ConnectedEnvironmentDaprComponent or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.ConnectedEnvironmentDaprComponent] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def create_or_update( + def begin_create_or_update( self, resource_group_name: str, connected_environment_name: str, component_name: str, - dapr_component_envelope: Union[_models.DaprComponent, IO[bytes]], + dapr_component_envelope: Union[_models.ConnectedEnvironmentDaprComponent, IO[bytes]], **kwargs: Any - ) -> _models.DaprComponent: + ) -> LROPoller[_models.ConnectedEnvironmentDaprComponent]: """Creates or updates a Dapr Component. Creates or updates a Dapr Component in a connected environment. @@ -464,12 +543,68 @@ def create_or_update( :param component_name: Name of the Dapr Component. Required. :type component_name: str :param dapr_component_envelope: Configuration details of the Dapr Component. Is either a - DaprComponent type or a IO[bytes] type. Required. - :type dapr_component_envelope: ~azure.mgmt.appcontainers.models.DaprComponent or IO[bytes] - :return: DaprComponent or the result of cls(response) - :rtype: ~azure.mgmt.appcontainers.models.DaprComponent + ConnectedEnvironmentDaprComponent type or a IO[bytes] type. Required. + :type dapr_component_envelope: + ~azure.mgmt.appcontainers.models.ConnectedEnvironmentDaprComponent or IO[bytes] + :return: An instance of LROPoller that returns either ConnectedEnvironmentDaprComponent or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.ConnectedEnvironmentDaprComponent] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConnectedEnvironmentDaprComponent] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + connected_environment_name=connected_environment_name, + component_name=component_name, + dapr_component_envelope=dapr_component_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ConnectedEnvironmentDaprComponent", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.ConnectedEnvironmentDaprComponent].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ConnectedEnvironmentDaprComponent]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, resource_group_name: str, connected_environment_name: str, component_name: str, **kwargs: Any + ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -478,58 +613,55 @@ def create_or_update( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DaprComponent] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(dapr_component_envelope, (IOBase, bytes)): - _content = dapr_component_envelope - else: - _json = self._serialize.body(dapr_component_envelope, "DaprComponent") - - _request = build_create_or_update_request( + _request = build_delete_request( resource_group_name=resource_group_name, connected_environment_name=connected_environment_name, component_name=component_name, subscription_id=self._config.subscription_id, api_version=api_version, - content_type=content_type, - json=_json, - content=_content, headers=_headers, params=_params, ) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DaprComponent", pipeline_response.http_response) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements + def begin_delete( self, resource_group_name: str, connected_environment_name: str, component_name: str, **kwargs: Any - ) -> None: + ) -> LROPoller[None]: """Delete a Dapr Component. Delete a Dapr Component from a connected environment. @@ -541,49 +673,52 @@ def delete( # pylint: disable=inconsistent-return-statements :type connected_environment_name: str :param component_name: Name of the Dapr Component. Required. :type component_name: str - :return: None or the result of cls(response) - :rtype: None + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + connected_environment_name=connected_environment_name, + component_name=component_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) - _request = build_delete_request( - resource_group_name=resource_group_name, - connected_environment_name=connected_environment_name, - component_name=component_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore - if cls: - return cls(pipeline_response, None, {}) # type: ignore + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace def list_secrets( diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_connected_environments_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_connected_environments_operations.py index 34b98e9d8093..c0d889095d91 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -31,12 +32,9 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._serialization import Serializer +from .._configuration import ContainerAppsAPIClientConfiguration +from .._serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -48,13 +46,13 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.App/connectedEnvironments") path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -72,16 +70,16 @@ 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", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -104,16 +102,16 @@ 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", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -137,7 +135,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", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -145,9 +143,9 @@ def build_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -173,16 +171,16 @@ 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", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -206,16 +204,17 @@ 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", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-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/connectedEnvironments/{connectedEnvironmentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -228,6 +227,8 @@ def build_update_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="PATCH", url=_url, params=_params, headers=_headers, **kwargs) @@ -239,7 +240,7 @@ def build_check_name_availability_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -247,9 +248,9 @@ def build_check_name_availability_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/checkNameAvailability", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -283,10 +284,10 @@ class ConnectedEnvironmentsOperations: 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") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerAppsAPIClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.ConnectedEnvironment"]: @@ -813,9 +814,73 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + @overload + def update( + self, + resource_group_name: str, + connected_environment_name: str, + environment_envelope: Optional[_models.ConnectedEnvironmentPatchResource] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ConnectedEnvironment: + """Update connected Environment's properties. + + Patches a Managed Environment. Only patching of tags is supported currently. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param connected_environment_name: Name of the connectedEnvironment. Required. + :type connected_environment_name: str + :param environment_envelope: Configuration details of the connectedEnvironment. Default value + is None. + :type environment_envelope: ~azure.mgmt.appcontainers.models.ConnectedEnvironmentPatchResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ConnectedEnvironment or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.ConnectedEnvironment + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + connected_environment_name: str, + environment_envelope: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ConnectedEnvironment: + """Update connected Environment's properties. + + Patches a Managed Environment. Only patching of tags is supported currently. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param connected_environment_name: Name of the connectedEnvironment. Required. + :type connected_environment_name: str + :param environment_envelope: Configuration details of the connectedEnvironment. Default value + is None. + :type environment_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ConnectedEnvironment or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.ConnectedEnvironment + :raises ~azure.core.exceptions.HttpResponseError: + """ + @distributed_trace def update( - self, resource_group_name: str, connected_environment_name: str, **kwargs: Any + self, + resource_group_name: str, + connected_environment_name: str, + environment_envelope: Optional[Union[_models.ConnectedEnvironmentPatchResource, IO[bytes]]] = None, + **kwargs: Any ) -> _models.ConnectedEnvironment: """Update connected Environment's properties. @@ -826,6 +891,10 @@ def update( :type resource_group_name: str :param connected_environment_name: Name of the connectedEnvironment. Required. :type connected_environment_name: str + :param environment_envelope: Configuration details of the connectedEnvironment. Is either a + ConnectedEnvironmentPatchResource type or a IO[bytes] type. Default value is None. + :type environment_envelope: ~azure.mgmt.appcontainers.models.ConnectedEnvironmentPatchResource + or IO[bytes] :return: ConnectedEnvironment or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.ConnectedEnvironment :raises ~azure.core.exceptions.HttpResponseError: @@ -838,17 +907,32 @@ def update( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ConnectedEnvironment] = kwargs.pop("cls", None) + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(environment_envelope, (IOBase, bytes)): + _content = environment_envelope + else: + if environment_envelope is not None: + _json = self._serialize.body(environment_envelope, "ConnectedEnvironmentPatchResource") + else: + _json = None + _request = build_update_request( resource_group_name=resource_group_name, connected_environment_name=connected_environment_name, subscription_id=self._config.subscription_id, api_version=api_version, + content_type=content_type, + json=_json, + content=_content, headers=_headers, params=_params, ) 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 9a01d4832b03..deafb464bfb0 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,31 +6,33 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterator, Optional, TypeVar, Union, cast, overload +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._serialization import Serializer +from .._configuration import ContainerAppsAPIClientConfiguration +from .._serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,16 +46,16 @@ 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", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/storages", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -76,16 +79,16 @@ 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", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/storages/{storageName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -110,7 +113,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -118,9 +121,9 @@ def build_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/storages/{storageName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -147,16 +150,16 @@ 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", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/storages/{storageName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -189,10 +192,10 @@ class ConnectedEnvironmentsStoragesOperations: 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") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerAppsAPIClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list( @@ -317,8 +320,77 @@ def get( return deserialized # type: ignore + def _create_or_update_initial( + self, + resource_group_name: str, + connected_environment_name: str, + storage_name: str, + storage_envelope: Union[_models.ConnectedEnvironmentStorage, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(storage_envelope, (IOBase, bytes)): + _content = storage_envelope + else: + _json = self._serialize.body(storage_envelope, "ConnectedEnvironmentStorage") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + connected_environment_name=connected_environment_name, + storage_name=storage_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + @overload - def create_or_update( + def begin_create_or_update( self, resource_group_name: str, connected_environment_name: str, @@ -327,7 +399,7 @@ def create_or_update( *, content_type: str = "application/json", **kwargs: Any - ) -> _models.ConnectedEnvironmentStorage: + ) -> LROPoller[_models.ConnectedEnvironmentStorage]: """Create or update storage for a connectedEnvironment. Create or update storage for a connectedEnvironment. @@ -344,13 +416,15 @@ def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: ConnectedEnvironmentStorage or the result of cls(response) - :rtype: ~azure.mgmt.appcontainers.models.ConnectedEnvironmentStorage + :return: An instance of LROPoller that returns either ConnectedEnvironmentStorage or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.ConnectedEnvironmentStorage] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def create_or_update( + def begin_create_or_update( self, resource_group_name: str, connected_environment_name: str, @@ -359,7 +433,7 @@ def create_or_update( *, content_type: str = "application/json", **kwargs: Any - ) -> _models.ConnectedEnvironmentStorage: + ) -> LROPoller[_models.ConnectedEnvironmentStorage]: """Create or update storage for a connectedEnvironment. Create or update storage for a connectedEnvironment. @@ -376,20 +450,22 @@ def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: ConnectedEnvironmentStorage or the result of cls(response) - :rtype: ~azure.mgmt.appcontainers.models.ConnectedEnvironmentStorage + :return: An instance of LROPoller that returns either ConnectedEnvironmentStorage or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.ConnectedEnvironmentStorage] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def create_or_update( + def begin_create_or_update( self, resource_group_name: str, connected_environment_name: str, storage_name: str, storage_envelope: Union[_models.ConnectedEnvironmentStorage, IO[bytes]], **kwargs: Any - ) -> _models.ConnectedEnvironmentStorage: + ) -> LROPoller[_models.ConnectedEnvironmentStorage]: """Create or update storage for a connectedEnvironment. Create or update storage for a connectedEnvironment. @@ -405,10 +481,65 @@ def create_or_update( ConnectedEnvironmentStorage type or a IO[bytes] type. Required. :type storage_envelope: ~azure.mgmt.appcontainers.models.ConnectedEnvironmentStorage or IO[bytes] - :return: ConnectedEnvironmentStorage or the result of cls(response) - :rtype: ~azure.mgmt.appcontainers.models.ConnectedEnvironmentStorage + :return: An instance of LROPoller that returns either ConnectedEnvironmentStorage or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.ConnectedEnvironmentStorage] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConnectedEnvironmentStorage] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + connected_environment_name=connected_environment_name, + storage_name=storage_name, + storage_envelope=storage_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ConnectedEnvironmentStorage", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.ConnectedEnvironmentStorage].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ConnectedEnvironmentStorage]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, resource_group_name: str, connected_environment_name: str, storage_name: str, **kwargs: Any + ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -417,58 +548,55 @@ def create_or_update( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConnectedEnvironmentStorage] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(storage_envelope, (IOBase, bytes)): - _content = storage_envelope - else: - _json = self._serialize.body(storage_envelope, "ConnectedEnvironmentStorage") - - _request = build_create_or_update_request( + _request = build_delete_request( resource_group_name=resource_group_name, connected_environment_name=connected_environment_name, storage_name=storage_name, subscription_id=self._config.subscription_id, api_version=api_version, - content_type=content_type, - json=_json, - content=_content, headers=_headers, params=_params, ) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectedEnvironmentStorage", pipeline_response.http_response) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements + def begin_delete( self, resource_group_name: str, connected_environment_name: str, storage_name: str, **kwargs: Any - ) -> None: + ) -> LROPoller[None]: """Delete storage for a connectedEnvironment. Delete storage for a connectedEnvironment. @@ -480,46 +608,49 @@ def delete( # pylint: disable=inconsistent-return-statements :type connected_environment_name: str :param storage_name: Name of the storage. Required. :type storage_name: str - :return: None or the result of cls(response) - :rtype: None + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - connected_environment_name=connected_environment_name, - storage_name=storage_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + connected_environment_name=connected_environment_name, + storage_name=storage_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_api_client_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_api_client_operations.py index b227a81c2bcf..865a2cbd890e 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_api_client_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_api_client_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from collections.abc import MutableMapping from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -26,10 +27,6 @@ from .._serialization import Serializer from .._vendor import ContainerAppsAPIClientMixinABC -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,16 +40,16 @@ def build_job_execution_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-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), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -79,15 +76,15 @@ def build_get_custom_domain_verification_id_request( # pylint: disable=name-too _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-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), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_auth_configs_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_auth_configs_operations.py index e8fd9c8b7fe2..6c30227daa63 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -26,12 +28,9 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._serialization import Serializer +from .._configuration import ContainerAppsAPIClientConfiguration +from .._serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,16 +44,16 @@ 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", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/authConfigs", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -78,16 +77,16 @@ 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", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/authConfigs/{authConfigName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -112,7 +111,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -120,9 +119,9 @@ def build_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/authConfigs/{authConfigName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -149,16 +148,16 @@ 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", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/authConfigs/{authConfigName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -191,10 +190,10 @@ class ContainerAppsAuthConfigsOperations: 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") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerAppsAPIClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list_by_container_app( diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_builds_by_container_app_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_builds_by_container_app_operations.py new file mode 100644 index 000000000000..438db5c55bc1 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_builds_by_container_app_operations.py @@ -0,0 +1,178 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 collections.abc import MutableMapping +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import urllib.parse + +from azure.core import PipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._configuration import ContainerAppsAPIClientConfiguration +from .._serialization import Deserializer, Serializer + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_request( + resource_group_name: str, container_app_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/builds", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "containerAppName": _SERIALIZER.url( + "container_app_name", container_app_name, "str", pattern=r"^[-\w\._\(\)]+$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class ContainerAppsBuildsByContainerAppOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s + :attr:`container_apps_builds_by_container_app` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerAppsAPIClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, resource_group_name: str, container_app_name: str, **kwargs: Any + ) -> Iterable["_models.ContainerAppsBuildResource"]: + """List Container Apps Build resources by Container App. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App the Build is associated. Required. + :type container_app_name: str + :return: An iterator like instance of either ContainerAppsBuildResource or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.ContainerAppsBuildResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ContainerAppsBuildCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ContainerAppsBuildCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_builds_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_builds_operations.py new file mode 100644 index 000000000000..def31cd5626f --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_builds_operations.py @@ -0,0 +1,312 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 collections.abc import MutableMapping +from typing import Any, Callable, Dict, Iterator, Optional, TypeVar, Union, cast + +from azure.core import PipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._configuration import ContainerAppsAPIClientConfiguration +from .._serialization import Deserializer, Serializer + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_get_request( + resource_group_name: str, container_app_name: str, build_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/builds/{buildName}", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "containerAppName": _SERIALIZER.url( + "container_app_name", container_app_name, "str", pattern=r"^[-\w\._\(\)]+$" + ), + "buildName": _SERIALIZER.url( + "build_name", build_name, "str", max_length=64, min_length=2, pattern=r"^[-\w\._\(\)]+$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, container_app_name: str, build_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/builds/{buildName}", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "containerAppName": _SERIALIZER.url( + "container_app_name", container_app_name, "str", pattern=r"^[-\w\._\(\)]+$" + ), + "buildName": _SERIALIZER.url( + "build_name", build_name, "str", max_length=64, min_length=2, pattern=r"^[-\w\._\(\)]+$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class ContainerAppsBuildsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s + :attr:`container_apps_builds` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerAppsAPIClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get( + self, resource_group_name: str, container_app_name: str, build_name: str, **kwargs: Any + ) -> _models.ContainerAppsBuildResource: + """Get a Container Apps Build resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App the Build is associated. Required. + :type container_app_name: str + :param build_name: The name of a build. Required. + :type build_name: str + :return: ContainerAppsBuildResource or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.ContainerAppsBuildResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ContainerAppsBuildResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + build_name=build_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ContainerAppsBuildResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _delete_initial( + self, resource_group_name: str, container_app_name: str, build_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + build_name=build_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, resource_group_name: str, container_app_name: str, build_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Delete a Container Apps Build resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App the Build is associated. Required. + :type container_app_name: str + :param build_name: The name of a build. Required. + :type build_name: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + build_name=build_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_diagnostics_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_diagnostics_operations.py index ba2a984b4e83..2e34f6a194e5 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,10 +6,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from collections.abc import MutableMapping from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -25,12 +27,9 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._serialization import Serializer +from .._configuration import ContainerAppsAPIClientConfiguration +from .._serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -44,16 +43,16 @@ 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", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/detectors", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -77,16 +76,16 @@ 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", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/detectors/{detectorName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -116,16 +115,16 @@ 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", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/detectorProperties/revisionsApi/revisions/", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -151,16 +150,16 @@ 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", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/detectorProperties/revisionsApi/revisions/{revisionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -185,16 +184,16 @@ 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", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/detectorProperties/rootApi/", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -226,10 +225,10 @@ class ContainerAppsDiagnosticsOperations: 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") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerAppsAPIClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list_detectors( diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_label_history_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_label_history_operations.py new file mode 100644 index 000000000000..89996c3da28f --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_label_history_operations.py @@ -0,0 +1,382 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 collections.abc import MutableMapping +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import urllib.parse + +from azure.core import PipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._configuration import ContainerAppsAPIClientConfiguration +from .._serialization import Deserializer, Serializer + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_label_history_request( + resource_group_name: str, + container_app_name: str, + subscription_id: str, + *, + filter: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/labelHistory", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "containerAppName": _SERIALIZER.url( + "container_app_name", container_app_name, "str", pattern=r"^[-\w\._\(\)]+$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_label_history_request( + resource_group_name: str, container_app_name: str, label_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/labelHistory/{labelName}", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "containerAppName": _SERIALIZER.url( + "container_app_name", container_app_name, "str", pattern=r"^[-\w\._\(\)]+$" + ), + "labelName": _SERIALIZER.url("label_name", label_name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_label_history_request( + resource_group_name: str, container_app_name: str, label_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/labelHistory/{labelName}", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "containerAppName": _SERIALIZER.url( + "container_app_name", container_app_name, "str", pattern=r"^[-\w\._\(\)]+$" + ), + "labelName": _SERIALIZER.url("label_name", label_name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class ContainerAppsLabelHistoryOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s + :attr:`container_apps_label_history` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerAppsAPIClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_label_history( + self, resource_group_name: str, container_app_name: str, filter: Optional[str] = None, **kwargs: Any + ) -> Iterable["_models.LabelHistory"]: + """Get the Label History for a given Container App. + + Get the Label History for a given Container App. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param filter: The filter to apply on the operation. Default value is None. + :type filter: str + :return: An iterator like instance of either LabelHistory or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.LabelHistory] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.LabelHistoryCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_label_history_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + subscription_id=self._config.subscription_id, + filter=filter, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("LabelHistoryCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get_label_history( + self, resource_group_name: str, container_app_name: str, label_name: str, **kwargs: Any + ) -> _models.LabelHistory: + """Get the history of a label. + + Get the history of a label. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param label_name: Name of the Container App label. Required. + :type label_name: str + :return: LabelHistory or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.LabelHistory + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.LabelHistory] = kwargs.pop("cls", None) + + _request = build_get_label_history_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + label_name=label_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("LabelHistory", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete_label_history( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, container_app_name: str, label_name: str, **kwargs: Any + ) -> None: + """Delete the history of a label. + + Delete the history of a label. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param label_name: Name of the Container App label. Required. + :type label_name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 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_label_history_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + label_name=label_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_operations.py index a12b500de835..086e04d332fa 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -31,12 +32,9 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._serialization import Serializer +from .._configuration import ContainerAppsAPIClientConfiguration +from .._serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -48,13 +46,13 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.App/containerApps") path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -72,16 +70,16 @@ 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", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -104,16 +102,16 @@ 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", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -137,7 +135,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", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -145,9 +143,9 @@ def build_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -173,16 +171,16 @@ 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", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -206,7 +204,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -214,9 +212,9 @@ def build_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -247,16 +245,16 @@ 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", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/listCustomHostNameAnalysis", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -282,16 +280,16 @@ 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", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/listSecrets", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -315,16 +313,16 @@ 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", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/getAuthtoken", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -348,16 +346,16 @@ def build_start_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-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), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -383,16 +381,16 @@ def build_stop_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-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), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -426,10 +424,10 @@ class ContainerAppsOperations: 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") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerAppsAPIClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.ContainerApp"]: diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_patches_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_patches_operations.py new file mode 100644 index 000000000000..f3786f8f9480 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_patches_operations.py @@ -0,0 +1,854 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 collections.abc import MutableMapping +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core import PipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._configuration import ContainerAppsAPIClientConfiguration +from .._serialization import Deserializer, Serializer + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_container_app_request( + resource_group_name: str, + container_app_name: str, + subscription_id: str, + *, + filter: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/patches", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "containerAppName": _SERIALIZER.url( + "container_app_name", container_app_name, "str", pattern=r"^[-\w\._\(\)]+$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, container_app_name: str, patch_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/patches/{patchName}", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "containerAppName": _SERIALIZER.url( + "container_app_name", container_app_name, "str", pattern=r"^[-\w\._\(\)]+$" + ), + "patchName": _SERIALIZER.url( + "patch_name", patch_name, "str", max_length=64, min_length=2, pattern=r"^[-\w\._\(\)]+$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, container_app_name: str, patch_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/patches/{patchName}", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "containerAppName": _SERIALIZER.url( + "container_app_name", container_app_name, "str", pattern=r"^[-\w\._\(\)]+$" + ), + "patchName": _SERIALIZER.url( + "patch_name", patch_name, "str", max_length=64, min_length=2, pattern=r"^[-\w\._\(\)]+$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_skip_configure_request( + resource_group_name: str, container_app_name: str, patch_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/patches/{patchName}/skipConfig", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "containerAppName": _SERIALIZER.url( + "container_app_name", container_app_name, "str", pattern=r"^[-\w\._\(\)]+$" + ), + "patchName": _SERIALIZER.url( + "patch_name", patch_name, "str", max_length=64, min_length=2, pattern=r"^[-\w\._\(\)]+$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_apply_request( + resource_group_name: str, container_app_name: str, patch_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/patches/{patchName}/apply", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "containerAppName": _SERIALIZER.url( + "container_app_name", container_app_name, "str", pattern=r"^[-\w\._\(\)]+$" + ), + "patchName": _SERIALIZER.url( + "patch_name", patch_name, "str", max_length=64, min_length=2, pattern=r"^[-\w\._\(\)]+$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class ContainerAppsPatchesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s + :attr:`container_apps_patches` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerAppsAPIClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_container_app( + self, resource_group_name: str, container_app_name: str, filter: Optional[str] = None, **kwargs: Any + ) -> Iterable["_models.ContainerAppsPatchResource"]: + """List Container Apps Patch resources by ContainerApp. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App the Patch is associated. Required. + :type container_app_name: str + :param filter: The filter to apply on the operation. For example, + $filter=properties/patchApplyStatus eq 'Succeeded'. Default value is None. + :type filter: str + :return: An iterator like instance of either ContainerAppsPatchResource or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.ContainerAppsPatchResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.PatchCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_container_app_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + subscription_id=self._config.subscription_id, + filter=filter, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("PatchCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get( + self, resource_group_name: str, container_app_name: str, patch_name: str, **kwargs: Any + ) -> _models.ContainerAppsPatchResource: + """Get details for specific Container Apps Patch by patch name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App the Patch is associated. Required. + :type container_app_name: str + :param patch_name: The name of the patch. Required. + :type patch_name: str + :return: ContainerAppsPatchResource or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.ContainerAppsPatchResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ContainerAppsPatchResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + patch_name=patch_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ContainerAppsPatchResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _delete_initial( + self, resource_group_name: str, container_app_name: str, patch_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + patch_name=patch_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, resource_group_name: str, container_app_name: str, patch_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Delete specific Container Apps Patch by patch name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App the Patch is associated. Required. + :type container_app_name: str + :param patch_name: The name of the patch. Required. + :type patch_name: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + patch_name=patch_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _skip_configure_initial( + self, + resource_group_name: str, + container_app_name: str, + patch_name: str, + patch_skip_config: Union[_models.PatchSkipConfig, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(patch_skip_config, (IOBase, bytes)): + _content = patch_skip_config + else: + _json = self._serialize.body(patch_skip_config, "PatchSkipConfig") + + _request = build_skip_configure_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + patch_name=patch_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_skip_configure( + self, + resource_group_name: str, + container_app_name: str, + patch_name: str, + patch_skip_config: _models.PatchSkipConfig, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Configure the Container Apps Patch skip option by patch name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App the Patch is associated. Required. + :type container_app_name: str + :param patch_name: The name of the patch. Required. + :type patch_name: str + :param patch_skip_config: Configure patcher to skip a patch or not. Required. + :type patch_skip_config: ~azure.mgmt.appcontainers.models.PatchSkipConfig + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_skip_configure( + self, + resource_group_name: str, + container_app_name: str, + patch_name: str, + patch_skip_config: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Configure the Container Apps Patch skip option by patch name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App the Patch is associated. Required. + :type container_app_name: str + :param patch_name: The name of the patch. Required. + :type patch_name: str + :param patch_skip_config: Configure patcher to skip a patch or not. Required. + :type patch_skip_config: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_skip_configure( + self, + resource_group_name: str, + container_app_name: str, + patch_name: str, + patch_skip_config: Union[_models.PatchSkipConfig, IO[bytes]], + **kwargs: Any + ) -> LROPoller[None]: + """Configure the Container Apps Patch skip option by patch name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App the Patch is associated. Required. + :type container_app_name: str + :param patch_name: The name of the patch. Required. + :type patch_name: str + :param patch_skip_config: Configure patcher to skip a patch or not. Is either a PatchSkipConfig + type or a IO[bytes] type. Required. + :type patch_skip_config: ~azure.mgmt.appcontainers.models.PatchSkipConfig or IO[bytes] + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._skip_configure_initial( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + patch_name=patch_name, + patch_skip_config=patch_skip_config, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _apply_initial( + self, resource_group_name: str, container_app_name: str, patch_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_apply_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + patch_name=patch_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_apply( + self, resource_group_name: str, container_app_name: str, patch_name: str, **kwargs: Any + ) -> LROPoller[_models.ContainerAppsPatchResource]: + """Apply a Container Apps Patch resource with patch name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App the Patch is associated. Required. + :type container_app_name: str + :param patch_name: The name of the patch. Required. + :type patch_name: str + :return: An instance of LROPoller that returns either ContainerAppsPatchResource or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.ContainerAppsPatchResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ContainerAppsPatchResource] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._apply_initial( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + patch_name=patch_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ContainerAppsPatchResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.ContainerAppsPatchResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ContainerAppsPatchResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_revision_replicas_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_revision_replicas_operations.py index 7360e0edb3e9..beec6b4f4856 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,10 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from collections.abc import MutableMapping from typing import Any, Callable, Dict, Optional, TypeVar +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -23,12 +25,9 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._serialization import Serializer +from .._configuration import ContainerAppsAPIClientConfiguration +from .._serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,16 +46,16 @@ 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", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{revisionName}/replicas/{replicaName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -82,16 +81,16 @@ 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", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{revisionName}/replicas", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -124,10 +123,10 @@ class ContainerAppsRevisionReplicasOperations: 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") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerAppsAPIClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def get_replica( 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 151f06d01c5f..3f22302825b2 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,10 +6,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from collections.abc import MutableMapping from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -25,12 +27,9 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._serialization import Serializer +from .._configuration import ContainerAppsAPIClientConfiguration +from .._serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,16 +48,16 @@ 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", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -84,16 +83,16 @@ 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", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{revisionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -118,16 +117,16 @@ 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", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{revisionName}/activate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -152,16 +151,16 @@ 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", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{revisionName}/deactivate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -186,16 +185,16 @@ 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", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{revisionName}/restart", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -228,10 +227,10 @@ class ContainerAppsRevisionsOperations: 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") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerAppsAPIClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list_revisions( diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_session_pools_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_session_pools_operations.py index d51bceb948ab..2b236a6c75ff 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_session_pools_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_session_pools_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -30,12 +32,9 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._serialization import Serializer +from .._configuration import ContainerAppsAPIClientConfiguration +from .._serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,13 +46,13 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.App/sessionPools") path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -71,16 +70,16 @@ 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", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/sessionPools", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -103,16 +102,16 @@ 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", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/sessionPools/{sessionPoolName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -138,7 +137,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -146,9 +145,9 @@ def build_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/sessionPools/{sessionPoolName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -176,7 +175,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", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -184,9 +183,9 @@ def build_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/sessionPools/{sessionPoolName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -214,16 +213,16 @@ 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", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/sessionPools/{sessionPoolName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -257,10 +256,10 @@ class ContainerAppsSessionPoolsOperations: 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") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerAppsAPIClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.SessionPool"]: 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 bc66fd573b44..2f5ff76e671f 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -30,12 +32,9 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._serialization import Serializer +from .._configuration import ContainerAppsAPIClientConfiguration +from .._serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,16 +48,16 @@ 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", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/sourcecontrols", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -82,16 +81,16 @@ 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", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/sourcecontrols/{sourceControlName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -111,12 +110,18 @@ def build_get_request( def build_create_or_update_request( - resource_group_name: str, container_app_name: str, source_control_name: str, subscription_id: str, **kwargs: Any + resource_group_name: str, + container_app_name: str, + source_control_name: str, + subscription_id: str, + *, + x_ms_github_auxiliary: Optional[str] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -124,9 +129,9 @@ def build_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/sourcecontrols/{sourceControlName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -140,6 +145,8 @@ def build_create_or_update_request( _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if x_ms_github_auxiliary is not None: + _headers["x-ms-github-auxiliary"] = _SERIALIZER.header("x_ms_github_auxiliary", x_ms_github_auxiliary, "str") if content_type is not None: _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -148,21 +155,29 @@ def build_create_or_update_request( def build_delete_request( - resource_group_name: str, container_app_name: str, source_control_name: str, subscription_id: str, **kwargs: Any + resource_group_name: str, + container_app_name: str, + source_control_name: str, + subscription_id: str, + *, + x_ms_github_auxiliary: Optional[str] = None, + ignore_workflow_deletion_failure: Optional[bool] = None, + delete_workflow: Optional[bool] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/sourcecontrols/{sourceControlName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -173,9 +188,17 @@ def build_delete_request( _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters + if ignore_workflow_deletion_failure is not None: + _params["ignoreWorkflowDeletionFailure"] = _SERIALIZER.query( + "ignore_workflow_deletion_failure", ignore_workflow_deletion_failure, "bool" + ) + if delete_workflow is not None: + _params["deleteWorkflow"] = _SERIALIZER.query("delete_workflow", delete_workflow, "bool") _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if x_ms_github_auxiliary is not None: + _headers["x-ms-github-auxiliary"] = _SERIALIZER.header("x_ms_github_auxiliary", x_ms_github_auxiliary, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) @@ -195,10 +218,10 @@ class ContainerAppsSourceControlsOperations: 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") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerAppsAPIClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list_by_container_app( @@ -355,6 +378,7 @@ def _create_or_update_initial( container_app_name: str, source_control_name: str, source_control_envelope: Union[_models.SourceControl, IO[bytes]], + x_ms_github_auxiliary: Optional[str] = None, **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -385,6 +409,7 @@ def _create_or_update_initial( container_app_name=container_app_name, source_control_name=source_control_name, subscription_id=self._config.subscription_id, + x_ms_github_auxiliary=x_ms_github_auxiliary, api_version=api_version, content_type=content_type, json=_json, @@ -425,6 +450,7 @@ def begin_create_or_update( container_app_name: str, source_control_name: str, source_control_envelope: _models.SourceControl, + x_ms_github_auxiliary: Optional[str] = None, *, content_type: str = "application/json", **kwargs: Any @@ -443,6 +469,9 @@ def begin_create_or_update( :param source_control_envelope: Properties used to create a Container App SourceControl. Required. :type source_control_envelope: ~azure.mgmt.appcontainers.models.SourceControl + :param x_ms_github_auxiliary: Github personal access token used for SourceControl. Default + value is None. + :type x_ms_github_auxiliary: str :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -459,6 +488,7 @@ def begin_create_or_update( container_app_name: str, source_control_name: str, source_control_envelope: IO[bytes], + x_ms_github_auxiliary: Optional[str] = None, *, content_type: str = "application/json", **kwargs: Any @@ -477,6 +507,9 @@ def begin_create_or_update( :param source_control_envelope: Properties used to create a Container App SourceControl. Required. :type source_control_envelope: IO[bytes] + :param x_ms_github_auxiliary: Github personal access token used for SourceControl. Default + value is None. + :type x_ms_github_auxiliary: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -493,6 +526,7 @@ def begin_create_or_update( container_app_name: str, source_control_name: str, source_control_envelope: Union[_models.SourceControl, IO[bytes]], + x_ms_github_auxiliary: Optional[str] = None, **kwargs: Any ) -> LROPoller[_models.SourceControl]: """Create or update the SourceControl for a Container App. @@ -509,6 +543,9 @@ def begin_create_or_update( :param source_control_envelope: Properties used to create a Container App SourceControl. Is either a SourceControl type or a IO[bytes] type. Required. :type source_control_envelope: ~azure.mgmt.appcontainers.models.SourceControl or IO[bytes] + :param x_ms_github_auxiliary: Github personal access token used for SourceControl. Default + value is None. + :type x_ms_github_auxiliary: str :return: An instance of LROPoller that returns either SourceControl or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.SourceControl] @@ -529,6 +566,7 @@ def begin_create_or_update( container_app_name=container_app_name, source_control_name=source_control_name, source_control_envelope=source_control_envelope, + x_ms_github_auxiliary=x_ms_github_auxiliary, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -563,7 +601,14 @@ def get_long_running_output(pipeline_response): ) def _delete_initial( - self, resource_group_name: str, container_app_name: str, source_control_name: str, **kwargs: Any + self, + resource_group_name: str, + container_app_name: str, + source_control_name: str, + x_ms_github_auxiliary: Optional[str] = None, + ignore_workflow_deletion_failure: Optional[bool] = None, + delete_workflow: Optional[bool] = None, + **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -584,6 +629,9 @@ def _delete_initial( container_app_name=container_app_name, source_control_name=source_control_name, subscription_id=self._config.subscription_id, + x_ms_github_auxiliary=x_ms_github_auxiliary, + ignore_workflow_deletion_failure=ignore_workflow_deletion_failure, + delete_workflow=delete_workflow, api_version=api_version, headers=_headers, params=_params, @@ -616,7 +664,14 @@ def _delete_initial( @distributed_trace def begin_delete( - self, resource_group_name: str, container_app_name: str, source_control_name: str, **kwargs: Any + self, + resource_group_name: str, + container_app_name: str, + source_control_name: str, + x_ms_github_auxiliary: Optional[str] = None, + ignore_workflow_deletion_failure: Optional[bool] = None, + delete_workflow: Optional[bool] = None, + **kwargs: Any ) -> LROPoller[None]: """Delete a Container App SourceControl. @@ -629,6 +684,14 @@ def begin_delete( :type container_app_name: str :param source_control_name: Name of the Container App SourceControl. Required. :type source_control_name: str + :param x_ms_github_auxiliary: Github personal access token used for SourceControl. Default + value is None. + :type x_ms_github_auxiliary: str + :param ignore_workflow_deletion_failure: Ignore Workflow Deletion Failure. Default value is + None. + :type ignore_workflow_deletion_failure: bool + :param delete_workflow: Delete workflow. Default value is None. + :type delete_workflow: bool :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -646,6 +709,9 @@ def begin_delete( resource_group_name=resource_group_name, container_app_name=container_app_name, source_control_name=source_control_name, + x_ms_github_auxiliary=x_ms_github_auxiliary, + ignore_workflow_deletion_failure=ignore_workflow_deletion_failure, + delete_workflow=delete_workflow, api_version=api_version, cls=lambda x, y, z: x, headers=_headers, diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_dapr_component_resiliency_policies_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_dapr_component_resiliency_policies_operations.py new file mode 100644 index 000000000000..ac796e268b60 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_dapr_component_resiliency_policies_operations.py @@ -0,0 +1,581 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 collections.abc import MutableMapping +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core import PipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._configuration import ContainerAppsAPIClientConfiguration +from .._serialization import Deserializer, Serializer + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_request( + resource_group_name: str, environment_name: str, component_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{componentName}/resiliencyPolicies", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "environmentName": _SERIALIZER.url("environment_name", environment_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "componentName": _SERIALIZER.url("component_name", component_name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, environment_name: str, component_name: str, name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{componentName}/resiliencyPolicies/{name}", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "environmentName": _SERIALIZER.url("environment_name", environment_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "componentName": _SERIALIZER.url("component_name", component_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "name": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, environment_name: str, component_name: str, name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{componentName}/resiliencyPolicies/{name}", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "environmentName": _SERIALIZER.url("environment_name", environment_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "componentName": _SERIALIZER.url("component_name", component_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "name": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, environment_name: str, component_name: str, name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{componentName}/resiliencyPolicies/{name}", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "environmentName": _SERIALIZER.url("environment_name", environment_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "componentName": _SERIALIZER.url("component_name", component_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "name": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class DaprComponentResiliencyPoliciesOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s + :attr:`dapr_component_resiliency_policies` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerAppsAPIClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, resource_group_name: str, environment_name: str, component_name: str, **kwargs: Any + ) -> Iterable["_models.DaprComponentResiliencyPolicy"]: + """Get the resiliency policies for a Dapr component. + + Get the resiliency policies for a Dapr component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param component_name: Name of the Dapr Component. Required. + :type component_name: str + :return: An iterator like instance of either DaprComponentResiliencyPolicy or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicy] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DaprComponentResiliencyPoliciesCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + component_name=component_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("DaprComponentResiliencyPoliciesCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get( + self, resource_group_name: str, environment_name: str, component_name: str, name: str, **kwargs: Any + ) -> _models.DaprComponentResiliencyPolicy: + """Get a Dapr component resiliency policy. + + Get a Dapr component resiliency policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param component_name: Name of the Dapr Component. Required. + :type component_name: str + :param name: Name of the Dapr Component Resiliency Policy. Required. + :type name: str + :return: DaprComponentResiliencyPolicy or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DaprComponentResiliencyPolicy] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + component_name=component_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("DaprComponentResiliencyPolicy", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def create_or_update( + self, + resource_group_name: str, + environment_name: str, + component_name: str, + name: str, + dapr_component_resiliency_policy_envelope: _models.DaprComponentResiliencyPolicy, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DaprComponentResiliencyPolicy: + """Creates or updates a Dapr component resiliency policy. + + Creates or updates a resiliency policy for a Dapr component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param component_name: Name of the Dapr Component. Required. + :type component_name: str + :param name: Name of the Dapr Component Resiliency Policy. Required. + :type name: str + :param dapr_component_resiliency_policy_envelope: Configuration details of the Dapr Component + Resiliency Policy. Required. + :type dapr_component_resiliency_policy_envelope: + ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicy + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: DaprComponentResiliencyPolicy or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + environment_name: str, + component_name: str, + name: str, + dapr_component_resiliency_policy_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DaprComponentResiliencyPolicy: + """Creates or updates a Dapr component resiliency policy. + + Creates or updates a resiliency policy for a Dapr component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param component_name: Name of the Dapr Component. Required. + :type component_name: str + :param name: Name of the Dapr Component Resiliency Policy. Required. + :type name: str + :param dapr_component_resiliency_policy_envelope: Configuration details of the Dapr Component + Resiliency Policy. Required. + :type dapr_component_resiliency_policy_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: DaprComponentResiliencyPolicy or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + environment_name: str, + component_name: str, + name: str, + dapr_component_resiliency_policy_envelope: Union[_models.DaprComponentResiliencyPolicy, IO[bytes]], + **kwargs: Any + ) -> _models.DaprComponentResiliencyPolicy: + """Creates or updates a Dapr component resiliency policy. + + Creates or updates a resiliency policy for a Dapr component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param component_name: Name of the Dapr Component. Required. + :type component_name: str + :param name: Name of the Dapr Component Resiliency Policy. Required. + :type name: str + :param dapr_component_resiliency_policy_envelope: Configuration details of the Dapr Component + Resiliency Policy. Is either a DaprComponentResiliencyPolicy type or a IO[bytes] type. + Required. + :type dapr_component_resiliency_policy_envelope: + ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicy or IO[bytes] + :return: DaprComponentResiliencyPolicy or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DaprComponentResiliencyPolicy] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(dapr_component_resiliency_policy_envelope, (IOBase, bytes)): + _content = dapr_component_resiliency_policy_envelope + else: + _json = self._serialize.body(dapr_component_resiliency_policy_envelope, "DaprComponentResiliencyPolicy") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + component_name=component_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("DaprComponentResiliencyPolicy", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, environment_name: str, component_name: str, name: str, **kwargs: Any + ) -> None: + """Delete a Dapr component resiliency policy. + + Delete a resiliency policy for a Dapr component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param component_name: Name of the Dapr Component. Required. + :type component_name: str + :param name: Name of the Dapr Component Resiliency Policy. Required. + :type name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + component_name=component_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_dapr_components_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_dapr_components_operations.py index 7c6a59d90eb8..34db75491e77 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -26,12 +28,9 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._serialization import Serializer +from .._configuration import ContainerAppsAPIClientConfiguration +from .._serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,16 +44,16 @@ 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", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -78,16 +77,16 @@ 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", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{componentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -112,7 +111,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -120,9 +119,9 @@ def build_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{componentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -149,16 +148,16 @@ 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", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{componentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -183,16 +182,16 @@ 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", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{componentName}/listSecrets", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -225,10 +224,10 @@ class DaprComponentsOperations: 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") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerAppsAPIClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list(self, resource_group_name: str, environment_name: str, **kwargs: Any) -> Iterable["_models.DaprComponent"]: diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_dapr_subscriptions_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_dapr_subscriptions_operations.py new file mode 100644 index 000000000000..3535ef1df5a1 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_dapr_subscriptions_operations.py @@ -0,0 +1,552 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 collections.abc import MutableMapping +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core import PipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._configuration import ContainerAppsAPIClientConfiguration +from .._serialization import Deserializer, Serializer + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_request( + resource_group_name: str, environment_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprSubscriptions", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "environmentName": _SERIALIZER.url("environment_name", environment_name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, environment_name: str, name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprSubscriptions/{name}", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "environmentName": _SERIALIZER.url("environment_name", environment_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "name": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, environment_name: str, name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprSubscriptions/{name}", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "environmentName": _SERIALIZER.url("environment_name", environment_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "name": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, environment_name: str, name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprSubscriptions/{name}", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "environmentName": _SERIALIZER.url("environment_name", environment_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "name": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class DaprSubscriptionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s + :attr:`dapr_subscriptions` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerAppsAPIClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, resource_group_name: str, environment_name: str, **kwargs: Any + ) -> Iterable["_models.DaprSubscription"]: + """Get the Dapr subscriptions for a managed environment. + + Get the Dapr subscriptions for a managed environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :return: An iterator like instance of either DaprSubscription or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.DaprSubscription] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DaprSubscriptionsCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("DaprSubscriptionsCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get( + self, resource_group_name: str, environment_name: str, name: str, **kwargs: Any + ) -> _models.DaprSubscription: + """Get a dapr subscription. + + Get a dapr subscription. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the Dapr subscription. Required. + :type name: str + :return: DaprSubscription or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.DaprSubscription + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DaprSubscription] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("DaprSubscription", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def create_or_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + dapr_subscription_envelope: _models.DaprSubscription, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DaprSubscription: + """Creates or updates a Dapr subscription. + + Creates or updates a Dapr subscription in a Managed Environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the Dapr subscription. Required. + :type name: str + :param dapr_subscription_envelope: Configuration details of the Dapr subscription. Required. + :type dapr_subscription_envelope: ~azure.mgmt.appcontainers.models.DaprSubscription + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: DaprSubscription or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.DaprSubscription + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + dapr_subscription_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DaprSubscription: + """Creates or updates a Dapr subscription. + + Creates or updates a Dapr subscription in a Managed Environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the Dapr subscription. Required. + :type name: str + :param dapr_subscription_envelope: Configuration details of the Dapr subscription. Required. + :type dapr_subscription_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: DaprSubscription or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.DaprSubscription + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + dapr_subscription_envelope: Union[_models.DaprSubscription, IO[bytes]], + **kwargs: Any + ) -> _models.DaprSubscription: + """Creates or updates a Dapr subscription. + + Creates or updates a Dapr subscription in a Managed Environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the Dapr subscription. Required. + :type name: str + :param dapr_subscription_envelope: Configuration details of the Dapr subscription. Is either a + DaprSubscription type or a IO[bytes] type. Required. + :type dapr_subscription_envelope: ~azure.mgmt.appcontainers.models.DaprSubscription or + IO[bytes] + :return: DaprSubscription or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.DaprSubscription + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DaprSubscription] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(dapr_subscription_envelope, (IOBase, bytes)): + _content = dapr_subscription_envelope + else: + _json = self._serialize.body(dapr_subscription_envelope, "DaprSubscription") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("DaprSubscription", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, environment_name: str, name: str, **kwargs: Any + ) -> None: + """Delete a Dapr subscription. + + Delete a Dapr subscription from a Managed Environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the Dapr subscription. Required. + :type name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_dot_net_components_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_dot_net_components_operations.py new file mode 100644 index 000000000000..0cf975f171f8 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_dot_net_components_operations.py @@ -0,0 +1,930 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 collections.abc import MutableMapping +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core import PipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._configuration import ContainerAppsAPIClientConfiguration +from .._serialization import Deserializer, Serializer + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_request( + resource_group_name: str, environment_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/dotNetComponents", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "environmentName": _SERIALIZER.url("environment_name", environment_name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, environment_name: str, name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/dotNetComponents/{name}", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "environmentName": _SERIALIZER.url("environment_name", environment_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "name": _SERIALIZER.url("name", name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, environment_name: str, name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/dotNetComponents/{name}", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "environmentName": _SERIALIZER.url("environment_name", environment_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "name": _SERIALIZER.url("name", name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request( + resource_group_name: str, environment_name: str, name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/dotNetComponents/{name}", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "environmentName": _SERIALIZER.url("environment_name", environment_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "name": _SERIALIZER.url("name", name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, environment_name: str, name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/dotNetComponents/{name}", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "environmentName": _SERIALIZER.url("environment_name", environment_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "name": _SERIALIZER.url("name", name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class DotNetComponentsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s + :attr:`dot_net_components` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerAppsAPIClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, resource_group_name: str, environment_name: str, **kwargs: Any + ) -> Iterable["_models.DotNetComponent"]: + """Get the .NET Components for a managed environment. + + Get the .NET Components for a managed environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :return: An iterator like instance of either DotNetComponent or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.DotNetComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DotNetComponentsCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("DotNetComponentsCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get(self, resource_group_name: str, environment_name: str, name: str, **kwargs: Any) -> _models.DotNetComponent: + """Get a .NET Component. + + Get a .NET Component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the .NET Component. Required. + :type name: str + :return: DotNetComponent or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.DotNetComponent + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DotNetComponent] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("DotNetComponent", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + environment_name: str, + name: str, + dot_net_component_envelope: Union[_models.DotNetComponent, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(dot_net_component_envelope, (IOBase, bytes)): + _content = dot_net_component_envelope + else: + _json = self._serialize.body(dot_net_component_envelope, "DotNetComponent") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + dot_net_component_envelope: _models.DotNetComponent, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.DotNetComponent]: + """Creates or updates a .NET Component. + + Creates or updates a .NET Component in a Managed Environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the .NET Component. Required. + :type name: str + :param dot_net_component_envelope: Configuration details of the .NET Component. Required. + :type dot_net_component_envelope: ~azure.mgmt.appcontainers.models.DotNetComponent + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either DotNetComponent or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.DotNetComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + dot_net_component_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.DotNetComponent]: + """Creates or updates a .NET Component. + + Creates or updates a .NET Component in a Managed Environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the .NET Component. Required. + :type name: str + :param dot_net_component_envelope: Configuration details of the .NET Component. Required. + :type dot_net_component_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either DotNetComponent or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.DotNetComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + dot_net_component_envelope: Union[_models.DotNetComponent, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.DotNetComponent]: + """Creates or updates a .NET Component. + + Creates or updates a .NET Component in a Managed Environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the .NET Component. Required. + :type name: str + :param dot_net_component_envelope: Configuration details of the .NET Component. Is either a + DotNetComponent type or a IO[bytes] type. Required. + :type dot_net_component_envelope: ~azure.mgmt.appcontainers.models.DotNetComponent or IO[bytes] + :return: An instance of LROPoller that returns either DotNetComponent or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.DotNetComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DotNetComponent] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + dot_net_component_envelope=dot_net_component_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("DotNetComponent", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.DotNetComponent].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.DotNetComponent]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _update_initial( + self, + resource_group_name: str, + environment_name: str, + name: str, + dot_net_component_envelope: Union[_models.DotNetComponent, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(dot_net_component_envelope, (IOBase, bytes)): + _content = dot_net_component_envelope + else: + _json = self._serialize.body(dot_net_component_envelope, "DotNetComponent") + + _request = build_update_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + dot_net_component_envelope: _models.DotNetComponent, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.DotNetComponent]: + """Update properties of a .NET Component. + + Patches a .NET Component using JSON Merge Patch. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the .NET Component. Required. + :type name: str + :param dot_net_component_envelope: Configuration details of the .NET Component. Required. + :type dot_net_component_envelope: ~azure.mgmt.appcontainers.models.DotNetComponent + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either DotNetComponent or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.DotNetComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + dot_net_component_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.DotNetComponent]: + """Update properties of a .NET Component. + + Patches a .NET Component using JSON Merge Patch. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the .NET Component. Required. + :type name: str + :param dot_net_component_envelope: Configuration details of the .NET Component. Required. + :type dot_net_component_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either DotNetComponent or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.DotNetComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + dot_net_component_envelope: Union[_models.DotNetComponent, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.DotNetComponent]: + """Update properties of a .NET Component. + + Patches a .NET Component using JSON Merge Patch. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the .NET Component. Required. + :type name: str + :param dot_net_component_envelope: Configuration details of the .NET Component. Is either a + DotNetComponent type or a IO[bytes] type. Required. + :type dot_net_component_envelope: ~azure.mgmt.appcontainers.models.DotNetComponent or IO[bytes] + :return: An instance of LROPoller that returns either DotNetComponent or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.DotNetComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DotNetComponent] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + dot_net_component_envelope=dot_net_component_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("DotNetComponent", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.DotNetComponent].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.DotNetComponent]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, resource_group_name: str, environment_name: str, name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, resource_group_name: str, environment_name: str, name: str, **kwargs: Any + ) -> LROPoller[None]: + """Delete a .NET Component. + + Delete a .NET Component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the .NET Component. Required. + :type name: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_functions_extension_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_functions_extension_operations.py new file mode 100644 index 000000000000..845455d0d24d --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_functions_extension_operations.py @@ -0,0 +1,168 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 collections.abc import MutableMapping +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core import PipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._configuration import ContainerAppsAPIClientConfiguration +from .._serialization import Deserializer, Serializer + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_invoke_functions_host_request( + resource_group_name: str, + container_app_name: str, + revision_name: str, + function_app_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{revisionName}/providers/Microsoft.App/functions/{functionAppName}/invoke", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "containerAppName": _SERIALIZER.url( + "container_app_name", container_app_name, "str", pattern=r"^[-\w\._\(\)]+$" + ), + "revisionName": _SERIALIZER.url("revision_name", revision_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "functionAppName": _SERIALIZER.url("function_app_name", function_app_name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class FunctionsExtensionOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s + :attr:`functions_extension` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerAppsAPIClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def invoke_functions_host( + self, + resource_group_name: str, + container_app_name: str, + revision_name: str, + function_app_name: str, + **kwargs: Any + ) -> str: + """Proxies a Functions host call to the function app backed by the container app. + + Proxies a Functions host call to the function app backed by the container app. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param revision_name: Name of the Container App Revision, the parent resource. Required. + :type revision_name: str + :param function_app_name: Name of the Function App, the extension resource. Required. + :type function_app_name: str + :return: str or the result of cls(response) + :rtype: str + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[str] = kwargs.pop("cls", None) + + _request = build_invoke_functions_host_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + revision_name=revision_name, + function_app_name=function_app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("str", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_http_route_config_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_http_route_config_operations.py new file mode 100644 index 000000000000..d67c801dad85 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_http_route_config_operations.py @@ -0,0 +1,748 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 collections.abc import MutableMapping +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core import PipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._configuration import ContainerAppsAPIClientConfiguration +from .._serialization import Deserializer, Serializer + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_get_request( + resource_group_name: str, environment_name: str, http_route_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/httpRouteConfigs/{httpRouteName}", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "environmentName": _SERIALIZER.url("environment_name", environment_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "httpRouteName": _SERIALIZER.url( + "http_route_name", http_route_name, "str", max_length=63, min_length=3, pattern=r"^[a-z][a-z0-9]*$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, environment_name: str, http_route_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/httpRouteConfigs/{httpRouteName}", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "environmentName": _SERIALIZER.url("environment_name", environment_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "httpRouteName": _SERIALIZER.url( + "http_route_name", http_route_name, "str", max_length=63, min_length=3, pattern=r"^[a-z][a-z0-9]*$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request( + resource_group_name: str, environment_name: str, http_route_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/httpRouteConfigs/{httpRouteName}", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "environmentName": _SERIALIZER.url("environment_name", environment_name, "str"), + "httpRouteName": _SERIALIZER.url("http_route_name", http_route_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, environment_name: str, http_route_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/httpRouteConfigs/{httpRouteName}", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "environmentName": _SERIALIZER.url("environment_name", environment_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "httpRouteName": _SERIALIZER.url( + "http_route_name", http_route_name, "str", max_length=63, min_length=3, pattern=r"^[a-z][a-z0-9]*$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_request( + resource_group_name: str, environment_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/httpRouteConfigs", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "environmentName": _SERIALIZER.url("environment_name", environment_name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class HttpRouteConfigOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s + :attr:`http_route_config` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerAppsAPIClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get( + self, resource_group_name: str, environment_name: str, http_route_name: str, **kwargs: Any + ) -> _models.HttpRouteConfig: + """Get the specified Managed Http Route Config. + + Get the specified Managed Http Route Config. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param http_route_name: Name of the Http Route Config Resource. Required. + :type http_route_name: str + :return: HttpRouteConfig or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.HttpRouteConfig + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.HttpRouteConfig] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + http_route_name=http_route_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("HttpRouteConfig", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def create_or_update( + self, + resource_group_name: str, + environment_name: str, + http_route_name: str, + http_route_config_envelope: Optional[_models.HttpRouteConfig] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.HttpRouteConfig: + """Create or Update a Http Route Config. + + Create or Update a Http Route Config. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param http_route_name: Name of the Http Route Config Resource. Required. + :type http_route_name: str + :param http_route_config_envelope: Http Route config to be created or updated. Default value is + None. + :type http_route_config_envelope: ~azure.mgmt.appcontainers.models.HttpRouteConfig + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: HttpRouteConfig or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.HttpRouteConfig + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + environment_name: str, + http_route_name: str, + http_route_config_envelope: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.HttpRouteConfig: + """Create or Update a Http Route Config. + + Create or Update a Http Route Config. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param http_route_name: Name of the Http Route Config Resource. Required. + :type http_route_name: str + :param http_route_config_envelope: Http Route config to be created or updated. Default value is + None. + :type http_route_config_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: HttpRouteConfig or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.HttpRouteConfig + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + environment_name: str, + http_route_name: str, + http_route_config_envelope: Optional[Union[_models.HttpRouteConfig, IO[bytes]]] = None, + **kwargs: Any + ) -> _models.HttpRouteConfig: + """Create or Update a Http Route Config. + + Create or Update a Http Route Config. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param http_route_name: Name of the Http Route Config Resource. Required. + :type http_route_name: str + :param http_route_config_envelope: Http Route config to be created or updated. Is either a + HttpRouteConfig type or a IO[bytes] type. Default value is None. + :type http_route_config_envelope: ~azure.mgmt.appcontainers.models.HttpRouteConfig or IO[bytes] + :return: HttpRouteConfig or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.HttpRouteConfig + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.HttpRouteConfig] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(http_route_config_envelope, (IOBase, bytes)): + _content = http_route_config_envelope + else: + if http_route_config_envelope is not None: + _json = self._serialize.body(http_route_config_envelope, "HttpRouteConfig") + else: + _json = None + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + http_route_name=http_route_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("HttpRouteConfig", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def update( + self, + resource_group_name: str, + environment_name: str, + http_route_name: str, + http_route_config_envelope: _models.HttpRouteConfig, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.HttpRouteConfig: + """Update tags of a manged http route object. + + Patches an http route config resource. Only patching of tags is supported. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param http_route_name: Name of the Http Route Config Resource. Required. + :type http_route_name: str + :param http_route_config_envelope: Properties of http route config that need to be updated. + Required. + :type http_route_config_envelope: ~azure.mgmt.appcontainers.models.HttpRouteConfig + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: HttpRouteConfig or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.HttpRouteConfig + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + environment_name: str, + http_route_name: str, + http_route_config_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.HttpRouteConfig: + """Update tags of a manged http route object. + + Patches an http route config resource. Only patching of tags is supported. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param http_route_name: Name of the Http Route Config Resource. Required. + :type http_route_name: str + :param http_route_config_envelope: Properties of http route config that need to be updated. + Required. + :type http_route_config_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: HttpRouteConfig or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.HttpRouteConfig + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + environment_name: str, + http_route_name: str, + http_route_config_envelope: Union[_models.HttpRouteConfig, IO[bytes]], + **kwargs: Any + ) -> _models.HttpRouteConfig: + """Update tags of a manged http route object. + + Patches an http route config resource. Only patching of tags is supported. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param http_route_name: Name of the Http Route Config Resource. Required. + :type http_route_name: str + :param http_route_config_envelope: Properties of http route config that need to be updated. Is + either a HttpRouteConfig type or a IO[bytes] type. Required. + :type http_route_config_envelope: ~azure.mgmt.appcontainers.models.HttpRouteConfig or IO[bytes] + :return: HttpRouteConfig or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.HttpRouteConfig + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.HttpRouteConfig] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(http_route_config_envelope, (IOBase, bytes)): + _content = http_route_config_envelope + else: + _json = self._serialize.body(http_route_config_envelope, "HttpRouteConfig") + + _request = build_update_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + http_route_name=http_route_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("HttpRouteConfig", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, environment_name: str, http_route_name: str, **kwargs: Any + ) -> None: + """Deletes the specified Managed Http Route. + + Deletes the specified Managed Http Route. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param http_route_name: Name of the Http Route Config Resource. Required. + :type http_route_name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + http_route_name=http_route_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list( + self, resource_group_name: str, environment_name: str, **kwargs: Any + ) -> Iterable["_models.HttpRouteConfig"]: + """Get the Managed Http Routes in a given managed environment. + + Get the Managed Http Routes in a given managed environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :return: An iterator like instance of either HttpRouteConfig or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.HttpRouteConfig] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.HttpRouteConfigCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("HttpRouteConfigCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_java_components_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_java_components_operations.py index cac4faa66b46..412084c37558 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_java_components_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_java_components_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -30,12 +32,9 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._serialization import Serializer +from .._configuration import ContainerAppsAPIClientConfiguration +from .._serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,16 +48,16 @@ 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", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/javaComponents", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -82,16 +81,16 @@ 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", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/javaComponents/{name}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -116,7 +115,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -124,9 +123,9 @@ def build_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/javaComponents/{name}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -153,7 +152,7 @@ def build_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", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -161,9 +160,9 @@ def build_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/javaComponents/{name}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -190,16 +189,16 @@ 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", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/javaComponents/{name}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -232,10 +231,10 @@ class JavaComponentsOperations: 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") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerAppsAPIClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list(self, resource_group_name: str, environment_name: str, **kwargs: Any) -> Iterable["_models.JavaComponent"]: @@ -870,7 +869,7 @@ def _delete_initial( def begin_delete( self, resource_group_name: str, environment_name: str, name: str, **kwargs: Any ) -> LROPoller[None]: - """Delete. + """Delete a Java Component. Delete a Java Component. 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 4136108cfc4c..8757370c3ed3 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,10 +6,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from collections.abc import MutableMapping from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -25,12 +27,9 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._serialization import Serializer +from .._configuration import ContainerAppsAPIClientConfiguration +from .._serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -44,16 +43,16 @@ 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", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-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", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -87,10 +86,10 @@ class JobsExecutionsOperations: 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") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerAppsAPIClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list( 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 1c5361b9133e..0202e624ac04 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -31,12 +32,9 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._serialization import Serializer +from .._configuration import ContainerAppsAPIClientConfiguration +from .._serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -50,16 +48,16 @@ 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", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/detectors", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -83,16 +81,16 @@ 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", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/detectors/{detectorName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -117,16 +115,16 @@ def build_proxy_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/detectorProperties/{apiName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -149,13 +147,13 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.App/jobs") path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -173,16 +171,16 @@ 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", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -203,16 +201,16 @@ 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", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -236,7 +234,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", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -244,9 +242,9 @@ def build_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -270,16 +268,16 @@ 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", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -301,7 +299,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", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -309,9 +307,9 @@ def build_update_request(resource_group_name: str, job_name: str, subscription_i _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -335,7 +333,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", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -343,9 +341,9 @@ def build_start_request(resource_group_name: str, job_name: str, subscription_id _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/start", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -371,16 +369,16 @@ 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", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-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}/stop", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -407,16 +405,16 @@ 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", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/stop", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -440,16 +438,16 @@ 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", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/listSecrets", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -467,7 +465,69 @@ def build_list_secrets_request( return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -class JobsOperations: +def build_resume_request(resource_group_name: str, job_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/resume", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "jobName": _SERIALIZER.url("job_name", job_name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_suspend_request(resource_group_name: str, job_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/suspend", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "jobName": _SERIALIZER.url("job_name", job_name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class JobsOperations: # pylint: disable=too-many-public-methods """ .. warning:: **DO NOT** instantiate this class directly. @@ -481,10 +541,10 @@ class JobsOperations: 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") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerAppsAPIClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list_detectors(self, resource_group_name: str, job_name: str, **kwargs: Any) -> Iterable["_models.Diagnostics"]: @@ -635,7 +695,7 @@ def get_detector( @distributed_trace def proxy_get(self, resource_group_name: str, job_name: str, api_name: str, **kwargs: Any) -> _models.Job: - """Get the properties of a Container App Job. + """Get the properties for a given Container App Job. Get the properties of a Container App Job. @@ -1909,3 +1969,233 @@ def list_secrets(self, resource_group_name: str, job_name: str, **kwargs: Any) - return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore + + def _resume_initial(self, resource_group_name: str, job_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_resume_request( + resource_group_name=resource_group_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_resume(self, resource_group_name: str, job_name: str, **kwargs: Any) -> LROPoller[_models.Job]: + """Resumes a suspended job. + + Resumes a suspended job. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param job_name: Name of the Job. Required. + :type job_name: str + :return: An instance of LROPoller that returns either Job or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.Job] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Job] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._resume_initial( + resource_group_name=resource_group_name, + job_name=job_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Job", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.Job].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.Job](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _suspend_initial(self, resource_group_name: str, job_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_suspend_request( + resource_group_name=resource_group_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_suspend(self, resource_group_name: str, job_name: str, **kwargs: Any) -> LROPoller[_models.Job]: + """Suspends a job. + + Suspends a job. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param job_name: Name of the Job. Required. + :type job_name: str + :return: An instance of LROPoller that returns either Job or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.Job] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Job] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._suspend_initial( + resource_group_name=resource_group_name, + job_name=job_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Job", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.Job].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.Job](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_logic_apps_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_logic_apps_operations.py new file mode 100644 index 000000000000..f7c635fc96cf --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_logic_apps_operations.py @@ -0,0 +1,1072 @@ +# pylint: disable=line-too-long,useless-suppression,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 collections.abc import MutableMapping +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core import PipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._configuration import ContainerAppsAPIClientConfiguration +from .._serialization import Deserializer, Serializer + +JSON = MutableMapping[str, Any] +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_get_request( + resource_group_name: str, container_app_name: str, logic_app_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/providers/Microsoft.App/logicApps/{logicAppName}", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "containerAppName": _SERIALIZER.url( + "container_app_name", container_app_name, "str", pattern=r"^[-\w\._\(\)]+$" + ), + "logicAppName": _SERIALIZER.url("logic_app_name", logic_app_name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, container_app_name: str, logic_app_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/providers/Microsoft.App/logicApps/{logicAppName}", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "containerAppName": _SERIALIZER.url( + "container_app_name", container_app_name, "str", pattern=r"^[-\w\._\(\)]+$" + ), + "logicAppName": _SERIALIZER.url("logic_app_name", logic_app_name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, container_app_name: str, logic_app_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/providers/Microsoft.App/logicApps/{logicAppName}", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "containerAppName": _SERIALIZER.url( + "container_app_name", container_app_name, "str", pattern=r"^[-\w\._\(\)]+$" + ), + "logicAppName": _SERIALIZER.url("logic_app_name", logic_app_name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_workflows_request( + resource_group_name: str, container_app_name: str, logic_app_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/providers/Microsoft.App/logicApps/{logicAppName}/workflows", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "containerAppName": _SERIALIZER.url( + "container_app_name", container_app_name, "str", pattern=r"^[-\w\._\(\)]+$" + ), + "logicAppName": _SERIALIZER.url("logic_app_name", logic_app_name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_workflow_request( + resource_group_name: str, + container_app_name: str, + logic_app_name: str, + workflow_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/providers/Microsoft.App/logicApps/{logicAppName}/workflows/{workflowName}", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "containerAppName": _SERIALIZER.url( + "container_app_name", container_app_name, "str", pattern=r"^[-\w\._\(\)]+$" + ), + "logicAppName": _SERIALIZER.url("logic_app_name", logic_app_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "workflowName": _SERIALIZER.url( + "workflow_name", workflow_name, "str", max_length=63, min_length=3, pattern=r"^[a-z][a-z0-9]*$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_deploy_workflow_artifacts_request( + resource_group_name: str, container_app_name: str, logic_app_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/providers/Microsoft.App/logicApps/{logicAppName}/deployWorkflowArtifacts", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "containerAppName": _SERIALIZER.url( + "container_app_name", container_app_name, "str", pattern=r"^[-\w\._\(\)]+$" + ), + "logicAppName": _SERIALIZER.url("logic_app_name", logic_app_name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_workflows_connections_request( + resource_group_name: str, container_app_name: str, logic_app_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/providers/Microsoft.App/logicApps/{logicAppName}/listWorkflowsConnections", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "containerAppName": _SERIALIZER.url( + "container_app_name", container_app_name, "str", pattern=r"^[-\w\._\(\)]+$" + ), + "logicAppName": _SERIALIZER.url("logic_app_name", logic_app_name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_invoke_request( + resource_group_name: str, + container_app_name: str, + logic_app_name: str, + subscription_id: str, + *, + x_ms_logic_apps_proxy_path: str, + x_ms_logic_apps_proxy_method: Union[str, _models.LogicAppsProxyMethod], + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/providers/Microsoft.App/logicApps/{logicAppName}/invoke", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "containerAppName": _SERIALIZER.url( + "container_app_name", container_app_name, "str", pattern=r"^[-\w\._\(\)]+$" + ), + "logicAppName": _SERIALIZER.url("logic_app_name", logic_app_name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["x-ms-logicApps-proxy-path"] = _SERIALIZER.header( + "x_ms_logic_apps_proxy_path", x_ms_logic_apps_proxy_path, "str" + ) + _headers["x-ms-logicApps-proxy-method"] = _SERIALIZER.header( + "x_ms_logic_apps_proxy_method", x_ms_logic_apps_proxy_method, "str" + ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class LogicAppsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s + :attr:`logic_apps` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerAppsAPIClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get( + self, resource_group_name: str, container_app_name: str, logic_app_name: str, **kwargs: Any + ) -> _models.LogicApp: + """Gets a logic app extension resource. + + Gets a logic app extension resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param logic_app_name: Name of the Logic App, the extension resource. Required. + :type logic_app_name: str + :return: LogicApp or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.LogicApp + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.LogicApp] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + logic_app_name=logic_app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("LogicApp", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def create_or_update( + self, + resource_group_name: str, + container_app_name: str, + logic_app_name: str, + resource: _models.LogicApp, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.LogicApp: + """Create or update a Logic App extension resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param logic_app_name: Name of the Logic App, the extension resource. Required. + :type logic_app_name: str + :param resource: Logic app resource properties. Required. + :type resource: ~azure.mgmt.appcontainers.models.LogicApp + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: LogicApp or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.LogicApp + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + container_app_name: str, + logic_app_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.LogicApp: + """Create or update a Logic App extension resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param logic_app_name: Name of the Logic App, the extension resource. Required. + :type logic_app_name: str + :param resource: Logic app resource properties. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: LogicApp or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.LogicApp + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + container_app_name: str, + logic_app_name: str, + resource: Union[_models.LogicApp, IO[bytes]], + **kwargs: Any + ) -> _models.LogicApp: + """Create or update a Logic App extension resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param logic_app_name: Name of the Logic App, the extension resource. Required. + :type logic_app_name: str + :param resource: Logic app resource properties. Is either a LogicApp type or a IO[bytes] type. + Required. + :type resource: ~azure.mgmt.appcontainers.models.LogicApp or IO[bytes] + :return: LogicApp or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.LogicApp + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.LogicApp] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "LogicApp") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + logic_app_name=logic_app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("LogicApp", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, container_app_name: str, logic_app_name: str, **kwargs: Any + ) -> None: + """Deletes a Logic App extension resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param logic_app_name: Name of the Logic App, the extension resource. Required. + :type logic_app_name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + logic_app_name=logic_app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list_workflows( + self, resource_group_name: str, container_app_name: str, logic_app_name: str, **kwargs: Any + ) -> Iterable["_models.WorkflowEnvelope"]: + """List the workflows for a logic app. + + List the workflows for a logic app. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param logic_app_name: Name of the Logic App, the extension resource. Required. + :type logic_app_name: str + :return: An iterator like instance of either WorkflowEnvelope or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.WorkflowEnvelope] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.WorkflowEnvelopeCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_workflows_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + logic_app_name=logic_app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("WorkflowEnvelopeCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get_workflow( + self, resource_group_name: str, container_app_name: str, logic_app_name: str, workflow_name: str, **kwargs: Any + ) -> _models.WorkflowEnvelope: + """Get workflow information by its name. + + Get workflow information by its name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param logic_app_name: Name of the Logic App, the extension resource. Required. + :type logic_app_name: str + :param workflow_name: Workflow name. Required. + :type workflow_name: str + :return: WorkflowEnvelope or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.WorkflowEnvelope + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.WorkflowEnvelope] = kwargs.pop("cls", None) + + _request = build_get_workflow_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + logic_app_name=logic_app_name, + workflow_name=workflow_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("WorkflowEnvelope", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def deploy_workflow_artifacts( + self, + resource_group_name: str, + container_app_name: str, + logic_app_name: str, + workflow_artifacts: Optional[_models.WorkflowArtifacts] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Creates or updates the artifacts for the logic app. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param logic_app_name: Name of the Logic App, the extension resource. Required. + :type logic_app_name: str + :param workflow_artifacts: Application settings and files of the workflow. Default value is + None. + :type workflow_artifacts: ~azure.mgmt.appcontainers.models.WorkflowArtifacts + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def deploy_workflow_artifacts( + self, + resource_group_name: str, + container_app_name: str, + logic_app_name: str, + workflow_artifacts: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Creates or updates the artifacts for the logic app. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param logic_app_name: Name of the Logic App, the extension resource. Required. + :type logic_app_name: str + :param workflow_artifacts: Application settings and files of the workflow. Default value is + None. + :type workflow_artifacts: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def deploy_workflow_artifacts( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + container_app_name: str, + logic_app_name: str, + workflow_artifacts: Optional[Union[_models.WorkflowArtifacts, IO[bytes]]] = None, + **kwargs: Any + ) -> None: + """Creates or updates the artifacts for the logic app. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param logic_app_name: Name of the Logic App, the extension resource. Required. + :type logic_app_name: str + :param workflow_artifacts: Application settings and files of the workflow. Is either a + WorkflowArtifacts type or a IO[bytes] type. Default value is None. + :type workflow_artifacts: ~azure.mgmt.appcontainers.models.WorkflowArtifacts or IO[bytes] + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(workflow_artifacts, (IOBase, bytes)): + _content = workflow_artifacts + else: + if workflow_artifacts is not None: + _json = self._serialize.body(workflow_artifacts, "WorkflowArtifacts") + else: + _json = None + + _request = build_deploy_workflow_artifacts_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + logic_app_name=logic_app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list_workflows_connections( + self, resource_group_name: str, container_app_name: str, logic_app_name: str, **kwargs: Any + ) -> _models.WorkflowEnvelope: + """Gets logic app's connections. + + Gets logic app's connections. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param logic_app_name: Name of the Logic App, the extension resource. Required. + :type logic_app_name: str + :return: WorkflowEnvelope or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.WorkflowEnvelope + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.WorkflowEnvelope] = kwargs.pop("cls", None) + + _request = build_list_workflows_connections_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + logic_app_name=logic_app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("WorkflowEnvelope", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def invoke( + self, + resource_group_name: str, + container_app_name: str, + logic_app_name: str, + x_ms_logic_apps_proxy_path: str, + x_ms_logic_apps_proxy_method: Union[str, _models.LogicAppsProxyMethod], + **kwargs: Any + ) -> JSON: + """Proxies a the API call to the logic app backed by the container app. + + Proxies a the API call to the logic app backed by the container app. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param logic_app_name: Name of the LogicApp App, the extension resource. Required. + :type logic_app_name: str + :param x_ms_logic_apps_proxy_path: The proxy path for the API call. Required. + :type x_ms_logic_apps_proxy_path: str + :param x_ms_logic_apps_proxy_method: The proxy method for the API call. Known values are: "GET" + and "POST". Required. + :type x_ms_logic_apps_proxy_method: str or + ~azure.mgmt.appcontainers.models.LogicAppsProxyMethod + :return: JSON or the result of cls(response) + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[JSON] = kwargs.pop("cls", None) + + _request = build_invoke_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + logic_app_name=logic_app_name, + subscription_id=self._config.subscription_id, + x_ms_logic_apps_proxy_path=x_ms_logic_apps_proxy_path, + x_ms_logic_apps_proxy_method=x_ms_logic_apps_proxy_method, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("object", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_maintenance_configurations_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_maintenance_configurations_operations.py new file mode 100644 index 000000000000..1f0521ea05c4 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_maintenance_configurations_operations.py @@ -0,0 +1,546 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 collections.abc import MutableMapping +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core import PipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._configuration import ContainerAppsAPIClientConfiguration +from .._serialization import Deserializer, Serializer + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_request( + resource_group_name: str, environment_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/maintenanceConfigurations", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "environmentName": _SERIALIZER.url("environment_name", environment_name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, environment_name: str, config_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/maintenanceConfigurations/{configName}", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "environmentName": _SERIALIZER.url("environment_name", environment_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "configName": _SERIALIZER.url("config_name", config_name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, environment_name: str, config_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/maintenanceConfigurations/{configName}", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "environmentName": _SERIALIZER.url("environment_name", environment_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "configName": _SERIALIZER.url("config_name", config_name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, environment_name: str, config_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/maintenanceConfigurations/{configName}", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "environmentName": _SERIALIZER.url("environment_name", environment_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "configName": _SERIALIZER.url("config_name", config_name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class MaintenanceConfigurationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s + :attr:`maintenance_configurations` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerAppsAPIClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, resource_group_name: str, environment_name: str, **kwargs: Any + ) -> Iterable["_models.MaintenanceConfigurationResource"]: + """Gets all maintenance configurations in the specified Managed Environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: The name of the Managed Environment. Required. + :type environment_name: str + :return: An iterator like instance of either MaintenanceConfigurationResource or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.MaintenanceConfigurationResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.MaintenanceConfigurationCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("MaintenanceConfigurationCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @overload + def create_or_update( + self, + resource_group_name: str, + environment_name: str, + config_name: str, + maintenance_configuration_envelope: _models.MaintenanceConfigurationResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MaintenanceConfigurationResource: + """Create or update the maintenance configuration for Managed Environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: The name of the Managed Environment. Required. + :type environment_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param maintenance_configuration_envelope: Parameters to set the maintenance configuration for + ManagedEnvironment . Required. + :type maintenance_configuration_envelope: + ~azure.mgmt.appcontainers.models.MaintenanceConfigurationResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: MaintenanceConfigurationResource or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.MaintenanceConfigurationResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + environment_name: str, + config_name: str, + maintenance_configuration_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MaintenanceConfigurationResource: + """Create or update the maintenance configuration for Managed Environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: The name of the Managed Environment. Required. + :type environment_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param maintenance_configuration_envelope: Parameters to set the maintenance configuration for + ManagedEnvironment . Required. + :type maintenance_configuration_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: MaintenanceConfigurationResource or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.MaintenanceConfigurationResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + environment_name: str, + config_name: str, + maintenance_configuration_envelope: Union[_models.MaintenanceConfigurationResource, IO[bytes]], + **kwargs: Any + ) -> _models.MaintenanceConfigurationResource: + """Create or update the maintenance configuration for Managed Environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: The name of the Managed Environment. Required. + :type environment_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :param maintenance_configuration_envelope: Parameters to set the maintenance configuration for + ManagedEnvironment . Is either a MaintenanceConfigurationResource type or a IO[bytes] type. + Required. + :type maintenance_configuration_envelope: + ~azure.mgmt.appcontainers.models.MaintenanceConfigurationResource or IO[bytes] + :return: MaintenanceConfigurationResource or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.MaintenanceConfigurationResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.MaintenanceConfigurationResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(maintenance_configuration_envelope, (IOBase, bytes)): + _content = maintenance_configuration_envelope + else: + _json = self._serialize.body(maintenance_configuration_envelope, "MaintenanceConfigurationResource") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + config_name=config_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("MaintenanceConfigurationResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, environment_name: str, config_name: str, **kwargs: Any + ) -> None: + """Deletes the maintenance configuration of a ManagedEnvironment . + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: The name of the Managed Environment. Required. + :type environment_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + config_name=config_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def get( + self, resource_group_name: str, environment_name: str, config_name: str, **kwargs: Any + ) -> _models.MaintenanceConfigurationResource: + """Gets the maintenance configuration of a ManagedEnvironment . + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: The name of the Managed Environment. Required. + :type environment_name: str + :param config_name: The name of the maintenance configuration. Required. + :type config_name: str + :return: MaintenanceConfigurationResource or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.MaintenanceConfigurationResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.MaintenanceConfigurationResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + config_name=config_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("MaintenanceConfigurationResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_certificates_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_certificates_operations.py index 76d6ea02f60a..c2de85a1a577 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -30,12 +32,9 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._serialization import Serializer +from .._configuration import ContainerAppsAPIClientConfiguration +from .._serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,16 +48,16 @@ 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", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/managedCertificates/{managedCertificateName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -83,7 +82,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", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -91,9 +90,9 @@ def build_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/managedCertificates/{managedCertificateName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -120,16 +119,16 @@ 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", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/managedCertificates/{managedCertificateName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -154,7 +153,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", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -162,9 +161,9 @@ def build_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/managedCertificates/{managedCertificateName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -191,16 +190,16 @@ 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", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/managedCertificates", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -232,10 +231,10 @@ class ManagedCertificatesOperations: 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") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerAppsAPIClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def get( 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 d5affe9c98b8..996d5f9aa1f5 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,10 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from collections.abc import MutableMapping from typing import Any, Callable, Dict, Optional, TypeVar +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -23,12 +25,9 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._serialization import Serializer +from .._configuration import ContainerAppsAPIClientConfiguration +from .._serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -42,16 +41,16 @@ 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", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/detectors", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -75,16 +74,16 @@ 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", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/detectors/{detectorName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -117,10 +116,10 @@ class ManagedEnvironmentDiagnosticsOperations: 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") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerAppsAPIClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list_detectors( diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environment_private_endpoint_connections_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environment_private_endpoint_connections_operations.py new file mode 100644 index 000000000000..8b02e46ffe9e --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environment_private_endpoint_connections_operations.py @@ -0,0 +1,708 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 collections.abc import MutableMapping +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core import PipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._configuration import ContainerAppsAPIClientConfiguration +from .._serialization import Deserializer, Serializer + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_request( + resource_group_name: str, environment_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/privateEndpointConnections", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "environmentName": _SERIALIZER.url("environment_name", environment_name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, + environment_name: str, + private_endpoint_connection_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "environmentName": _SERIALIZER.url("environment_name", environment_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, + environment_name: str, + private_endpoint_connection_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "environmentName": _SERIALIZER.url("environment_name", environment_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, + environment_name: str, + private_endpoint_connection_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "environmentName": _SERIALIZER.url("environment_name", environment_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class ManagedEnvironmentPrivateEndpointConnectionsOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s + :attr:`managed_environment_private_endpoint_connections` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerAppsAPIClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, resource_group_name: str, environment_name: str, **kwargs: Any + ) -> Iterable["_models.PrivateEndpointConnection"]: + """List private endpoint connections for a given managed environment. + + List private endpoint connections for a given managed environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :return: An iterator like instance of either PrivateEndpointConnection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get( + self, resource_group_name: str, environment_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Get a private endpoint connection for a given managed environment. + + Get a private endpoint connection for a given managed environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. Required. + :type private_endpoint_connection_name: str + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + environment_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection_envelope: Union[_models.PrivateEndpointConnection, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(private_endpoint_connection_envelope, (IOBase, bytes)): + _content = private_endpoint_connection_envelope + else: + _json = self._serialize.body(private_endpoint_connection_envelope, "PrivateEndpointConnection") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + environment_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection_envelope: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PrivateEndpointConnection]: + """Update the state of a private endpoint connection for a given managed environment. + + Update the state of a private endpoint connection for a given managed environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. Required. + :type private_endpoint_connection_name: str + :param private_endpoint_connection_envelope: The resource of private endpoint and its + properties. Required. + :type private_endpoint_connection_envelope: + ~azure.mgmt.appcontainers.models.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + environment_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PrivateEndpointConnection]: + """Update the state of a private endpoint connection for a given managed environment. + + Update the state of a private endpoint connection for a given managed environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. Required. + :type private_endpoint_connection_name: str + :param private_endpoint_connection_envelope: The resource of private endpoint and its + properties. Required. + :type private_endpoint_connection_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + environment_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection_envelope: Union[_models.PrivateEndpointConnection, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.PrivateEndpointConnection]: + """Update the state of a private endpoint connection for a given managed environment. + + Update the state of a private endpoint connection for a given managed environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. Required. + :type private_endpoint_connection_name: str + :param private_endpoint_connection_envelope: The resource of private endpoint and its + properties. Is either a PrivateEndpointConnection type or a IO[bytes] type. Required. + :type private_endpoint_connection_envelope: + ~azure.mgmt.appcontainers.models.PrivateEndpointConnection or IO[bytes] + :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + environment_name=environment_name, + private_endpoint_connection_name=private_endpoint_connection_name, + private_endpoint_connection_envelope=private_endpoint_connection_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.PrivateEndpointConnection].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.PrivateEndpointConnection]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, resource_group_name: str, environment_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, resource_group_name: str, environment_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Delete a private endpoint connection for a given managed environment. + + Delete a private endpoint connection for a given managed environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. Required. + :type private_endpoint_connection_name: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + environment_name=environment_name, + private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environment_private_link_resources_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environment_private_link_resources_operations.py new file mode 100644 index 000000000000..952e740d67ba --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environment_private_link_resources_operations.py @@ -0,0 +1,176 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 collections.abc import MutableMapping +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import urllib.parse + +from azure.core import PipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._configuration import ContainerAppsAPIClientConfiguration +from .._serialization import Deserializer, Serializer + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_request( + resource_group_name: str, environment_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/privateLinkResources", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "environmentName": _SERIALIZER.url("environment_name", environment_name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class ManagedEnvironmentPrivateLinkResourcesOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s + :attr:`managed_environment_private_link_resources` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerAppsAPIClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, resource_group_name: str, environment_name: str, **kwargs: Any + ) -> Iterable["_models.PrivateLinkResource"]: + """List private link resources for a given managed environment. + + List private link resources for a given managed environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :return: An iterator like instance of either PrivateLinkResource or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.PrivateLinkResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environment_usages_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environment_usages_operations.py index bb65531a38a7..690eb992cc3e 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environment_usages_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environment_usages_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,10 +6,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from collections.abc import MutableMapping from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -25,12 +27,9 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._serialization import Serializer +from .._configuration import ContainerAppsAPIClientConfiguration +from .._serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -44,16 +43,16 @@ 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", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/usages", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -85,10 +84,10 @@ class ManagedEnvironmentUsagesOperations: 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") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerAppsAPIClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list(self, resource_group_name: str, environment_name: str, **kwargs: Any) -> Iterable["_models.Usage"]: 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 6e910faf44cf..89b7274f1d21 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,10 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from collections.abc import MutableMapping from typing import Any, Callable, Dict, Optional, TypeVar +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -23,12 +25,9 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._serialization import Serializer +from .._configuration import ContainerAppsAPIClientConfiguration +from .._serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -42,16 +41,16 @@ 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", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/detectorProperties/rootApi/", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -83,10 +82,10 @@ class ManagedEnvironmentsDiagnosticsOperations: 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") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerAppsAPIClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def get_root(self, resource_group_name: str, environment_name: str, **kwargs: Any) -> _models.ManagedEnvironment: 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 6305ae423fdd..bb8b30ffc6ef 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -31,12 +32,9 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._serialization import Serializer +from .._configuration import ContainerAppsAPIClientConfiguration +from .._serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -48,13 +46,13 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.App/managedEnvironments") path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -72,16 +70,16 @@ 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", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -104,16 +102,16 @@ 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", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -137,7 +135,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", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -145,9 +143,9 @@ def build_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -173,16 +171,16 @@ 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", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -206,7 +204,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -214,9 +212,9 @@ def build_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -242,16 +240,16 @@ 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", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/getAuthtoken", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -275,16 +273,16 @@ def build_list_workload_profile_states_request( # pylint: disable=name-too-long _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/workloadProfileStates", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -316,10 +314,10 @@ class ManagedEnvironmentsOperations: 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") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerAppsAPIClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.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 d147317cecc5..73dca4f47956 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,10 +6,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -24,12 +26,9 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._serialization import Serializer +from .._configuration import ContainerAppsAPIClientConfiguration +from .._serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,16 +42,16 @@ 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", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/storages", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -76,16 +75,16 @@ 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", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/storages/{storageName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -110,7 +109,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", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -118,9 +117,9 @@ def build_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/storages/{storageName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -147,16 +146,16 @@ 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", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/storages/{storageName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -189,10 +188,10 @@ class ManagedEnvironmentsStoragesOperations: 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") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerAppsAPIClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list( @@ -452,7 +451,7 @@ def create_or_update( response = pipeline_response.http_response - if response.status_code not in [200]: + 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) 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 6e4a17317749..e1653ff62ee8 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,10 +6,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -24,12 +26,9 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._serialization import Serializer +from .._configuration import ContainerAppsAPIClientConfiguration +from .._serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +42,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", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -51,9 +50,9 @@ def build_check_name_availability_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/checkNameAvailability", - ) # pylint: disable=line-too-long + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -87,10 +86,10 @@ class NamespacesOperations: 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") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerAppsAPIClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @overload def check_name_availability( 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 ff1b29321be7..2dde34e03eb1 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 @@ -5,10 +5,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from collections.abc import MutableMapping from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -25,12 +26,9 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._serialization import Serializer +from .._configuration import ContainerAppsAPIClientConfiguration +from .._serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -42,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", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -71,10 +69,10 @@ class Operations: 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") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerAppsAPIClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.OperationDetail"]: diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_usages_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_usages_operations.py index 274659d5210c..5613d55964e4 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_usages_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_usages_operations.py @@ -5,10 +5,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from collections.abc import MutableMapping from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -25,12 +26,9 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._serialization import Serializer +from .._configuration import ContainerAppsAPIClientConfiguration +from .._serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -42,7 +40,7 @@ def build_list_request(location: str, subscription_id: str, **kwargs: Any) -> Ht _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -51,7 +49,7 @@ def build_list_request(location: str, subscription_id: str, **kwargs: Any) -> Ht ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str", pattern=r"^[-\w\._]+$"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -79,10 +77,10 @@ class UsagesOperations: 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") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerAppsAPIClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list(self, location: str, **kwargs: Any) -> Iterable["_models.Usage"]: diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_create_or_update.py new file mode 100644 index 000000000000..7b87707aa2f4 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_create_or_update.py @@ -0,0 +1,62 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python app_resiliency_create_or_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + response = client.app_resiliency.create_or_update( + resource_group_name="rg", + app_name="testcontainerApp0", + name="resiliency-policy-1", + resiliency_envelope={ + "properties": { + "circuitBreakerPolicy": {"consecutiveErrors": 5, "intervalInSeconds": 10, "maxEjectionPercent": 50}, + "httpConnectionPool": {"http1MaxPendingRequests": 1024, "http2MaxRequests": 1024}, + "httpRetryPolicy": { + "matches": { + "errors": ["5xx", "connect-failure", "reset", "retriable-headers", "retriable-status-codes"], + "headers": [{"header": "X-Content-Type", "match": {"prefixMatch": "GOATS"}}], + "httpStatusCodes": [502, 503], + }, + "maxRetries": 5, + "retryBackOff": {"initialDelayInMilliseconds": 1000, "maxIntervalInMilliseconds": 10000}, + }, + "tcpConnectionPool": {"maxConnections": 100}, + "tcpRetryPolicy": {"maxConnectAttempts": 3}, + "timeoutPolicy": {"connectionTimeoutInSeconds": 5, "responseTimeoutInSeconds": 15}, + } + }, + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/AppResiliency_CreateOrUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_delete.py new file mode 100644 index 000000000000..a60aa988c395 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_delete.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python app_resiliency_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + client.app_resiliency.delete( + resource_group_name="rg", + app_name="testcontainerApp0", + name="resiliency-policy-1", + ) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/AppResiliency_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_get.py new file mode 100644 index 000000000000..882d8041c772 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_get.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python app_resiliency_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + response = client.app_resiliency.get( + resource_group_name="rg", + app_name="testcontainerApp0", + name="resiliency-policy-1", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/AppResiliency_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_list.py new file mode 100644 index 000000000000..b6d25511cf8c --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_list.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python app_resiliency_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + response = client.app_resiliency.list( + resource_group_name="rg", + app_name="testcontainerApp0", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/AppResiliency_List.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_patch.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_patch.py new file mode 100644 index 000000000000..3d45ced92172 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_patch.py @@ -0,0 +1,47 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python app_resiliency_patch.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + response = client.app_resiliency.update( + resource_group_name="rg", + app_name="testcontainerApp0", + name="resiliency-policy-1", + resiliency_envelope={ + "properties": {"timeoutPolicy": {"connectionTimeoutInSeconds": 40, "responseTimeoutInSeconds": 30}} + }, + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/AppResiliency_Patch.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/auth_configs_blob_storage_token_store_client_id_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/auth_configs_blob_storage_token_store_client_id_create_or_update.py new file mode 100644 index 000000000000..4c456d8373d1 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/auth_configs_blob_storage_token_store_client_id_create_or_update.py @@ -0,0 +1,65 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python auth_configs_blob_storage_token_store_client_id_create_or_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.container_apps_auth_configs.create_or_update( + resource_group_name="rg1", + container_app_name="myapp", + auth_config_name="current", + auth_config_envelope={ + "properties": { + "encryptionSettings": { + "containerAppAuthEncryptionSecretName": "testEncryptionSecretName", + "containerAppAuthSigningSecretName": "testSigningSecretName", + }, + "globalValidation": {"unauthenticatedClientAction": "AllowAnonymous"}, + "identityProviders": { + "facebook": {"registration": {"appId": "123", "appSecretSettingName": "facebook-secret"}} + }, + "login": { + "tokenStore": { + "azureBlobStorage": { + "blobContainerUri": "https://test.blob.core.windows.net/container1", + "clientId": "00000000-0000-0000-0000-000000000000", + } + } + }, + "platform": {"enabled": True}, + } + }, + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/AuthConfigs_BlobStorageTokenStore_ClientId_CreateOrUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/auth_configs_blob_storage_token_store_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/auth_configs_blob_storage_token_store_create_or_update.py new file mode 100644 index 000000000000..2f585f5c753c --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/auth_configs_blob_storage_token_store_create_or_update.py @@ -0,0 +1,65 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python auth_configs_blob_storage_token_store_create_or_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.container_apps_auth_configs.create_or_update( + resource_group_name="rg1", + container_app_name="myapp", + auth_config_name="current", + auth_config_envelope={ + "properties": { + "encryptionSettings": { + "containerAppAuthEncryptionSecretName": "testEncryptionSecretName", + "containerAppAuthSigningSecretName": "testSigningSecretName", + }, + "globalValidation": {"unauthenticatedClientAction": "AllowAnonymous"}, + "identityProviders": { + "facebook": {"registration": {"appId": "123", "appSecretSettingName": "facebook-secret"}} + }, + "login": { + "tokenStore": { + "azureBlobStorage": { + "blobContainerUri": "https://test.blob.core.windows.net/container1", + "managedIdentityResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity1", + } + } + }, + "platform": {"enabled": True}, + } + }, + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/AuthConfigs_BlobStorageTokenStore_CreateOrUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/auth_configs_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/auth_configs_create_or_update.py index 9b9569f91ecb..621d07c2f29e 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -51,6 +52,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/AuthConfigs_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-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 21c98adf07ea..9de6fefd2bba 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,6 @@ def main(): ) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/AuthConfigs_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-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 c120ce52d802..1e8b41c0c444 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/AuthConfigs_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-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 2701f3339112..b7073829ac1b 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/AuthConfigs_ListByContainer.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-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 f7e1088781a7..96674ea98d50 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/AvailableWorkloadProfiles_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-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 542d9edc4e72..def739cb7f31 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/BillingMeters_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-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..6e0668920fd8 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_create_or_update.py @@ -0,0 +1,66 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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/2025-02-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..9f9015cd5e6c --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_delete.py @@ -0,0 +1,42 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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/2025-02-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..ffe1fdb96b75 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_get.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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/2025-02-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..e302647eaf3c --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_list_by_resource_group.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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/2025-02-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..ca68b2f67370 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_list_by_subscription.py @@ -0,0 +1,41 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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/2025-02-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..abf4d449713e --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_update.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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/2025-02-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..8256184eaefe --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_create_or_update.py @@ -0,0 +1,71 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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/2025-02-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..4123fb1db88e --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_delete.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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/2025-02-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..f18e260633ae --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_get.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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/2025-02-02-preview/examples/Builds_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_list_auth_token.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_list_auth_token.py new file mode 100644 index 000000000000..51f63d51f24f --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_list_auth_token.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python builds_list_auth_token.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.build_auth_token.list( + resource_group_name="rg", + builder_name="testBuilder", + build_name="testBuild", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/Builds_ListAuthToken.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_list_by_builder_resource.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_list_by_builder_resource.py new file mode 100644 index 000000000000..5c2a0d12ec29 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_list_by_builder_resource.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python builds_list_by_builder_resource.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.builds_by_builder_resource.list( + resource_group_name="rg", + builder_name="testBuilder", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-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 4805dfa7171d..23b1ae61056a 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/Certificate_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/Certificate_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_create_or_update_from_key_vault.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_create_or_update_from_key_vault.py index 51838f03ab07..ad77e7001b7d 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_create_or_update_from_key_vault.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_create_or_update_from_key_vault.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/Certificate_CreateOrUpdate_FromKeyVault.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/Certificate_CreateOrUpdate_FromKeyVault.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_delete.py index a0abbfb8976f..8c80f10ee732 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_delete.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_delete.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,6 @@ def main(): ) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/Certificate_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-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 2800519acebe..7483953b347a 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_get.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/Certificate_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-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 be746ac5466f..6c00467ebdd6 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -41,6 +42,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/Certificates_CheckNameAvailability.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-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 77ffa5eacfe9..d9accf10450c 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/Certificates_ListByManagedEnvironment.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-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 2980e968f4db..7160bccb6fa3 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificates_patch.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificates_patch.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -39,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/Certificates_Patch.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-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 e4944d4df4b2..20f5d26bdfac 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -30,14 +31,14 @@ def main(): subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) - response = client.connected_environments_certificates.create_or_update( + response = client.connected_environments_certificates.begin_create_or_update( resource_group_name="examplerg", connected_environment_name="testcontainerenv", certificate_name="certificate-firendly-name", - ) + ).result() print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/ConnectedEnvironmentsCertificate_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-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 d949f0ea3e2d..134aa400b880 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -30,13 +31,13 @@ def main(): subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) - client.connected_environments_certificates.delete( + client.connected_environments_certificates.begin_delete( resource_group_name="examplerg", connected_environment_name="testcontainerenv", certificate_name="certificate-firendly-name", - ) + ).result() -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/ConnectedEnvironmentsCertificate_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-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 c2434fd68cde..47f9d373457b 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/ConnectedEnvironmentsCertificate_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-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 e88bc03f5162..af1c0d463207 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -41,6 +42,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/ConnectedEnvironmentsCertificates_CheckNameAvailability.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-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 ba3dfb6a1e91..0a16f9760b83 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/ConnectedEnvironmentsCertificates_ListByConnectedEnvironment.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-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 67010b80a742..24d0254f1271 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -30,15 +31,15 @@ def main(): subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) - response = client.connected_environments_certificates.update( + response = client.connected_environments_certificates.begin_update( resource_group_name="examplerg", connected_environment_name="testcontainerenv", certificate_name="certificate-firendly-name", certificate_envelope={"tags": {"tag1": "value1", "tag2": "value2"}}, - ) + ).result() print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/ConnectedEnvironmentsCertificates_Patch.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-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 62b416badd4f..62153f3ae623 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -49,6 +50,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/ConnectedEnvironments_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-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 ba5fe77d8bf6..c24cfd6caa73 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -30,7 +31,7 @@ def main(): subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", ) - response = client.connected_environments_dapr_components.create_or_update( + response = client.connected_environments_dapr_components.begin_create_or_update( resource_group_name="examplerg", connected_environment_name="myenvironment", component_name="reddog", @@ -47,13 +48,20 @@ def main(): ], "scopes": ["container-app-1", "container-app-2"], "secrets": [{"name": "masterkey", "value": "keyvalue"}], + "serviceComponentBind": [ + { + "metadata": {"name": "daprcomponentBind", "value": "redis-bind"}, + "name": "statestore", + "serviceId": "/subscriptions/9f7371f1-b593-4c3c-84e2-9167806ad358/resourceGroups/ca-syn2-group/providers/Microsoft.App/containerapps/cappredis", + } + ], "version": "v1", } }, - ) + ).result() print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/ConnectedEnvironmentsDaprComponents_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-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 f336b924c420..70ea63e1dbc5 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -30,13 +31,13 @@ def main(): subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", ) - client.connected_environments_dapr_components.delete( + client.connected_environments_dapr_components.begin_delete( resource_group_name="examplerg", connected_environment_name="myenvironment", component_name="reddog", - ) + ).result() -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/ConnectedEnvironmentsDaprComponents_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-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 57f2d9982902..059523b32069 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/ConnectedEnvironmentsDaprComponents_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-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 e6ec22c92c49..2d7fae2f14e1 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/ConnectedEnvironmentsDaprComponents_List.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-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 9209803f5fdd..aeebf6485cff 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/ConnectedEnvironmentsDaprComponents_ListSecrets.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-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 5c4ed97c0fda..d77325eb38f9 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -36,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/ConnectedEnvironments_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-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 ce3168aad8a3..b285ffee08bd 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/ConnectedEnvironments_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-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 a2ff361cc6ff..cf1e5649ffa1 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/ConnectedEnvironments_ListByResourceGroup.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-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 f7cbcb699ccf..6d57700f8ad4 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -35,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/ConnectedEnvironments_ListBySubscription.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-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 f6c29ae6c941..b929bc103daa 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/ConnectedEnvironments_Patch.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-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 9630e65c9581..088290e190b4 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -30,7 +31,7 @@ def main(): subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", ) - response = client.connected_environments_storages.create_or_update( + response = client.connected_environments_storages.begin_create_or_update( resource_group_name="examplerg", connected_environment_name="env", storage_name="jlaw-demo1", @@ -44,10 +45,10 @@ def main(): } } }, - ) + ).result() print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/ConnectedEnvironmentsStorages_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-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 e1c6fdca32f8..6605b9429bf5 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -30,13 +31,13 @@ def main(): subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", ) - client.connected_environments_storages.delete( + client.connected_environments_storages.begin_delete( resource_group_name="examplerg", connected_environment_name="env", storage_name="jlaw-demo1", - ) + ).result() -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/ConnectedEnvironmentsStorages_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-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 0e36e6e51b51..651f0b8da467 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/ConnectedEnvironmentsStorages_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-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 74d2dc5d2280..64b65360ee3a 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/ConnectedEnvironmentsStorages_List.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/ConnectedEnvironmentsStorages_List.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_builds_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_builds_delete.py new file mode 100644 index 000000000000..d618e86aa47b --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_builds_delete.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python container_apps_builds_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + client.container_apps_builds.begin_delete( + resource_group_name="rg", + container_app_name="testCapp", + build_name="testBuild", + ).result() + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/ContainerAppsBuilds_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_builds_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_builds_get.py new file mode 100644 index 000000000000..27e64f705976 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_builds_get.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python container_apps_builds_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.container_apps_builds.get( + resource_group_name="rg", + container_app_name="testCapp", + build_name="testBuild", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/ContainerAppsBuilds_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_builds_list_by_container_app.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_builds_list_by_container_app.py new file mode 100644 index 000000000000..62d47b9e8029 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_builds_list_by_container_app.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python container_apps_builds_list_by_container_app.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.container_apps_builds_by_container_app.list( + resource_group_name="rg", + container_app_name="testCapp", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/ContainerAppsBuilds_ListByContainerApp.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_check_name_availability.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_check_name_availability.py index f721af3dacaf..0014230b4b95 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/ContainerApps_CheckNameAvailability.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-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 6456520b6fae..ed64a0235142 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -32,7 +33,7 @@ def main(): response = client.container_apps.begin_create_or_update( resource_group_name="rg", - container_app_name="testcontainerapp0", + container_app_name="testcontainerApp0", container_app_envelope={ "identity": { "type": "SystemAssigned,UserAssigned", @@ -44,6 +45,13 @@ def main(): "properties": { "configuration": { "dapr": { + "appHealth": { + "enabled": True, + "path": "/health", + "probeIntervalSeconds": 3, + "probeTimeoutMilliseconds": 1000, + "threshold": 3, + }, "appPort": 3000, "appProtocol": "http", "enableApiLogging": True, @@ -51,6 +59,7 @@ def main(): "httpMaxRequestSize": 10, "httpReadBufferSize": 30, "logLevel": "debug", + "maxConcurrency": 10, }, "identitySettings": [ { @@ -102,18 +111,30 @@ def main(): ], "stickySessions": {"affinity": "sticky"}, "targetPort": 3000, - "traffic": [{"label": "production", "revisionName": "testcontainerapp0-ab1234", "weight": 100}], + "traffic": [{"label": "production", "revisionName": "testcontainerApp0-ab1234", "weight": 100}], }, "maxInactiveRevisions": 10, - "runtime": {"java": {"enableMetrics": True}}, + "revisionTransitionThreshold": 100, + "runtime": { + "dotnet": {"autoConfigureDataProtection": True}, + "java": { + "enableMetrics": True, + "javaAgent": { + "enabled": True, + "logging": { + "loggerSettings": [{"level": "debug", "logger": "org.springframework.boot"}] + }, + }, + }, + }, "service": {"type": "redis"}, }, "environmentId": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube", "template": { "containers": [ { - "image": "repo/testcontainerapp0:v1", - "name": "testcontainerapp0", + "image": "repo/testcontainerApp0:v1", + "name": "testcontainerApp0", "probes": [ { "httpGet": { @@ -136,9 +157,9 @@ def main(): { "args": ["-c", "while true; do echo hello; sleep 10;done"], "command": ["/bin/sh"], - "image": "repo/testcontainerapp0:v4", + "image": "repo/testcontainerApp0:v4", "name": "testinitcontainerApp0", - "resources": {"cpu": 0.5, "memory": "1Gi"}, + "resources": {"cpu": 0.2, "gpu": 1, "memory": "100Mi"}, } ], "scale": { @@ -176,6 +197,8 @@ def main(): }, "serviceBinds": [ { + "clientType": "dotnet", + "customizedKeys": {"DesiredKey": "defaultKey"}, "name": "redisService", "serviceId": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/containerApps/redisService", } @@ -192,6 +215,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/ContainerApps_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/ContainerApps_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_create_or_update_connected_environment.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_create_or_update_connected_environment.py new file mode 100644 index 000000000000..588daf8dcd14 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_create_or_update_connected_environment.py @@ -0,0 +1,164 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python container_apps_create_or_update_connected_environment.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + response = client.container_apps.begin_create_or_update( + resource_group_name="rg", + container_app_name="testcontainerApp0", + container_app_envelope={ + "extendedLocation": { + "name": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.ExtendedLocation/customLocations/testcustomlocation", + "type": "CustomLocation", + }, + "location": "East US", + "properties": { + "configuration": { + "dapr": { + "appPort": 3000, + "appProtocol": "http", + "enableApiLogging": True, + "enabled": True, + "httpMaxRequestSize": 10, + "httpReadBufferSize": 30, + "logLevel": "debug", + }, + "ingress": { + "additionalPortMappings": [ + {"external": True, "targetPort": 1234}, + {"exposedPort": 3456, "external": False, "targetPort": 2345}, + ], + "clientCertificateMode": "accept", + "corsPolicy": { + "allowCredentials": True, + "allowedHeaders": ["HEADER1", "HEADER2"], + "allowedMethods": ["GET", "POST"], + "allowedOrigins": ["https://a.test.com", "https://b.test.com"], + "exposeHeaders": ["HEADER3", "HEADER4"], + "maxAge": 1234, + }, + "customDomains": [ + { + "bindingType": "SniEnabled", + "certificateId": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/connectedEnvironments/demokube/certificates/my-certificate-for-my-name-dot-com", + "name": "www.my-name.com", + }, + { + "bindingType": "SniEnabled", + "certificateId": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/connectedEnvironments/demokube/certificates/my-certificate-for-my-other-name-dot-com", + "name": "www.my-other-name.com", + }, + ], + "external": True, + "ipSecurityRestrictions": [ + { + "action": "Allow", + "description": "Allowing all IP's within the subnet below to access containerapp", + "ipAddressRange": "192.168.1.1/32", + "name": "Allow work IP A subnet", + }, + { + "action": "Allow", + "description": "Allowing all IP's within the subnet below to access containerapp", + "ipAddressRange": "192.168.1.1/8", + "name": "Allow work IP B subnet", + }, + ], + "stickySessions": {"affinity": "sticky"}, + "targetPort": 3000, + "traffic": [{"label": "production", "revisionName": "testcontainerApp0-ab1234", "weight": 100}], + }, + "maxInactiveRevisions": 10, + "revisionTransitionThreshold": 100, + "runtime": { + "dotnet": {"autoConfigureDataProtection": True}, + "java": { + "enableMetrics": True, + "javaAgent": { + "enabled": True, + "logging": { + "loggerSettings": [{"level": "debug", "logger": "org.springframework.boot"}] + }, + }, + }, + }, + }, + "environmentId": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/connectedEnvironments/demokube", + "template": { + "containers": [ + { + "image": "repo/testcontainerApp0:v1", + "name": "testcontainerApp0", + "probes": [ + { + "httpGet": { + "httpHeaders": [{"name": "Custom-Header", "value": "Awesome"}], + "path": "/health", + "port": 8080, + }, + "initialDelaySeconds": 3, + "periodSeconds": 3, + "type": "Liveness", + } + ], + } + ], + "initContainers": [ + { + "args": ["-c", "while true; do echo hello; sleep 10;done"], + "command": ["/bin/sh"], + "image": "repo/testcontainerApp0:v4", + "name": "testinitcontainerApp0", + "resources": {"cpu": 0.2, "memory": "100Mi"}, + } + ], + "scale": { + "cooldownPeriod": 350, + "maxReplicas": 5, + "minReplicas": 1, + "pollingInterval": 35, + "rules": [ + { + "custom": {"metadata": {"concurrentRequests": "50"}, "type": "http"}, + "name": "httpscalingrule", + } + ], + }, + }, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/ContainerApps_CreateOrUpdate_ConnectedEnvironment.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_delete.py index 411680a6f8c0..12e55632a001 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -32,10 +33,10 @@ def main(): client.container_apps.begin_delete( resource_group_name="rg", - container_app_name="testworkerapp0", + container_app_name="testWorkerApp0", ).result() -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/ContainerApps_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-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 5940968675c3..2d27fe032f36 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/ContainerAppsDiagnostics_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-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 ce98d274c863..e5dcf52f1410 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/ContainerAppsDiagnostics_List.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-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 631def6ccb19..0fb7f9e9a90c 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -30,13 +31,13 @@ def main(): subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) - response = client.container_apps_diagnostics.get_root( + response = client.container_apps.get( resource_group_name="rg", - container_app_name="testcontainerapp0", + container_app_name="testcontainerApp0", ) print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/ContainerApps_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-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 ec5f56b5b4d7..33744a960434 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -32,11 +33,11 @@ def main(): response = client.container_apps.get_auth_token( resource_group_name="rg", - container_app_name="testcontainerapp0", + container_app_name="testcontainerApp0", ) print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/ContainerApps_GetAuthToken.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/ContainerApps_GetAuthToken.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_kind_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_kind_create_or_update.py new file mode 100644 index 000000000000..6d672cb4ffc5 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_kind_create_or_update.py @@ -0,0 +1,65 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python container_apps_kind_create_or_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.container_apps.begin_create_or_update( + resource_group_name="rg", + container_app_name="testcontainerAppKind", + container_app_envelope={ + "kind": "workflowapp", + "location": "East Us", + "managedBy": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg/providers/Microsoft.Web/sites/testcontainerAppKind", + "properties": { + "configuration": { + "activeRevisionsMode": "Single", + "ingress": {"allowInsecure": True, "external": True, "targetPort": 80}, + }, + "managedEnvironmentId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/testmanagedenv3", + "template": { + "containers": [ + { + "image": "default/logicapps-base:latest", + "name": "logicapps-container", + "resources": {"cpu": 1, "memory": "2.0Gi"}, + } + ], + "scale": {"cooldownPeriod": 350, "maxReplicas": 30, "minReplicas": 1, "pollingInterval": 35}, + }, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/ContainerApps_Kind_CreateOrUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_list_by_resource_group.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_list_by_resource_group.py index 311fe3c0e07d..8b667d153a87 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/ContainerApps_ListByResourceGroup.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-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 a81ca3dc2b05..cff12b08ec2d 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -35,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/ContainerApps_ListBySubscription.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-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 f6bc1a24a3d3..65d91f2a5d9d 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -32,11 +33,11 @@ def main(): response = client.container_apps.list_custom_host_name_analysis( resource_group_name="rg", - container_app_name="testcontainerapp0", + container_app_name="testcontainerApp0", ) print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/ContainerApps_ListCustomHostNameAnalysis.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-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 04c15cdc26d0..d0210c4da434 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -32,11 +33,11 @@ def main(): response = client.container_apps.list_secrets( resource_group_name="rg", - container_app_name="testcontainerapp0", + container_app_name="testcontainerApp0", ) print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/ContainerApps_ListSecrets.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-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 c41549c54961..5714476615cc 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -32,7 +33,7 @@ def main(): response = client.container_apps.begin_create_or_update( resource_group_name="rg", - container_app_name="testcontainerappmanagedby", + container_app_name="testcontainerAppManagedBy", container_app_envelope={ "location": "East US", "managedBy": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.AppPlatform/Spring/springapp", @@ -42,7 +43,7 @@ def main(): "exposedPort": 4000, "external": True, "targetPort": 3000, - "traffic": [{"revisionName": "testcontainerappmanagedby-ab1234", "weight": 100}], + "traffic": [{"revisionName": "testcontainerAppManagedBy-ab1234", "weight": 100}], "transport": "tcp", } }, @@ -50,8 +51,8 @@ def main(): "template": { "containers": [ { - "image": "repo/testcontainerappmanagedby:v1", - "name": "testcontainerappmanagedby", + "image": "repo/testcontainerAppManagedBy:v1", + "name": "testcontainerAppManagedBy", "probes": [ { "initialDelaySeconds": 3, @@ -76,6 +77,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/ContainerApps_ManagedBy_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-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 30ec1e28d0a1..0d998c0265f7 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -32,12 +33,19 @@ def main(): response = client.container_apps.begin_update( resource_group_name="rg", - container_app_name="testcontainerapp0", + container_app_name="testcontainerApp0", container_app_envelope={ "location": "East US", "properties": { "configuration": { "dapr": { + "appHealth": { + "enabled": True, + "path": "/health", + "probeIntervalSeconds": 3, + "probeTimeoutMilliseconds": 1000, + "threshold": 3, + }, "appPort": 3000, "appProtocol": "http", "enableApiLogging": True, @@ -45,6 +53,7 @@ def main(): "httpMaxRequestSize": 10, "httpReadBufferSize": 30, "logLevel": "debug", + "maxConcurrency": 10, }, "ingress": { "customDomains": [ @@ -76,17 +85,29 @@ def main(): ], "stickySessions": {"affinity": "sticky"}, "targetPort": 3000, - "traffic": [{"label": "production", "revisionName": "testcontainerapp0-ab1234", "weight": 100}], + "traffic": [{"label": "production", "revisionName": "testcontainerApp0-ab1234", "weight": 100}], }, "maxInactiveRevisions": 10, - "runtime": {"java": {"enableMetrics": True}}, + "revisionTransitionThreshold": 100, + "runtime": { + "dotnet": {"autoConfigureDataProtection": True}, + "java": { + "enableMetrics": True, + "javaAgent": { + "enabled": True, + "logging": { + "loggerSettings": [{"level": "debug", "logger": "org.springframework.boot"}] + }, + }, + }, + }, "service": {"type": "redis"}, }, "template": { "containers": [ { - "image": "repo/testcontainerapp0:v1", - "name": "testcontainerapp0", + "image": "repo/testcontainerApp0:v1", + "name": "testcontainerApp0", "probes": [ { "httpGet": { @@ -103,9 +124,9 @@ def main(): ], "initContainers": [ { - "image": "repo/testcontainerapp0:v4", + "image": "repo/testcontainerApp0:v4", "name": "testinitcontainerApp0", - "resources": {"cpu": 0.5, "memory": "1Gi"}, + "resources": {"cpu": 0.2, "memory": "100Mi"}, } ], "scale": { @@ -122,6 +143,8 @@ def main(): }, "serviceBinds": [ { + "clientType": "dotnet", + "customizedKeys": {"DesiredKey": "defaultKey"}, "name": "service", "serviceId": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/containerApps/service", } @@ -134,6 +157,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/ContainerApps_Patch.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/ContainerApps_Patch.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_patches_apply.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_patches_apply.py new file mode 100644 index 000000000000..8970b2310f34 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_patches_apply.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python container_apps_patches_apply.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.container_apps_patches.begin_apply( + resource_group_name="rg", + container_app_name="test-app", + patch_name="testPatch-25fe4b", + ).result() + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/ContainerAppsPatches_Apply.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_patches_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_patches_delete.py new file mode 100644 index 000000000000..338a6646d9a1 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_patches_delete.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python container_apps_patches_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + client.container_apps_patches.begin_delete( + resource_group_name="rg", + container_app_name="test-app", + patch_name="testPatch-25fe4b", + ).result() + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/ContainerAppsPatches_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_patches_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_patches_get.py new file mode 100644 index 000000000000..7b10f7abf0b9 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_patches_get.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python container_apps_patches_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.container_apps_patches.get( + resource_group_name="rg", + container_app_name="test-app", + patch_name="testPatch-25fe4b", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/ContainerAppsPatches_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_patches_list_by_container_app.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_patches_list_by_container_app.py new file mode 100644 index 000000000000..4ac3dfd296f8 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_patches_list_by_container_app.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python container_apps_patches_list_by_container_app.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.container_apps_patches.list_by_container_app( + resource_group_name="rg", + container_app_name="test-app", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/ContainerAppsPatches_ListByContainerApp.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_patches_skip_configure.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_patches_skip_configure.py new file mode 100644 index 000000000000..96109d0e2cf3 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_patches_skip_configure.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python container_apps_patches_skip_configure.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + client.container_apps_patches.begin_skip_configure( + resource_group_name="rg", + container_app_name="test-app", + patch_name="testPatch-25fe4b", + patch_skip_config={"skip": True}, + ).result() + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/ContainerAppsPatches_Skip_Configure.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_source_to_cloud_app_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_source_to_cloud_app_create_or_update.py new file mode 100644 index 000000000000..38b1c7ea01a4 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_source_to_cloud_app_create_or_update.py @@ -0,0 +1,168 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python container_apps_source_to_cloud_app_create_or_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + response = client.container_apps.begin_create_or_update( + resource_group_name="rg", + container_app_name="testcontainerApp0", + container_app_envelope={ + "location": "East US", + "properties": { + "configuration": { + "dapr": { + "appPort": 3000, + "appProtocol": "http", + "enableApiLogging": True, + "enabled": True, + "httpMaxRequestSize": 10, + "httpReadBufferSize": 30, + "logLevel": "debug", + }, + "ingress": { + "additionalPortMappings": [ + {"external": True, "targetPort": 1234}, + {"exposedPort": 3456, "external": False, "targetPort": 2345}, + ], + "clientCertificateMode": "accept", + "corsPolicy": { + "allowCredentials": True, + "allowedHeaders": ["HEADER1", "HEADER2"], + "allowedMethods": ["GET", "POST"], + "allowedOrigins": ["https://a.test.com", "https://b.test.com"], + "exposeHeaders": ["HEADER3", "HEADER4"], + "maxAge": 1234, + }, + "customDomains": [ + { + "bindingType": "SniEnabled", + "certificateId": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube/certificates/my-certificate-for-my-name-dot-com", + "name": "www.my-name.com", + }, + { + "bindingType": "SniEnabled", + "certificateId": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube/certificates/my-certificate-for-my-other-name-dot-com", + "name": "www.my-other-name.com", + }, + ], + "external": True, + "ipSecurityRestrictions": [ + { + "action": "Allow", + "description": "Allowing all IP's within the subnet below to access containerapp", + "ipAddressRange": "192.168.1.1/32", + "name": "Allow work IP A subnet", + }, + { + "action": "Allow", + "description": "Allowing all IP's within the subnet below to access containerapp", + "ipAddressRange": "192.168.1.1/8", + "name": "Allow work IP B subnet", + }, + ], + "stickySessions": {"affinity": "sticky"}, + "targetPort": 3000, + "traffic": [{"label": "production", "revisionName": "testcontainerApp0-ab1234", "weight": 100}], + }, + "maxInactiveRevisions": 10, + "revisionTransitionThreshold": 100, + "service": {"type": "redis"}, + }, + "environmentId": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube", + "patchingConfiguration": {"patchingMode": "Automatic"}, + "template": { + "containers": [ + { + "image": "", + "imageType": "CloudBuild", + "name": "testcontainerApp0", + "probes": [ + { + "httpGet": { + "httpHeaders": [{"name": "Custom-Header", "value": "Awesome"}], + "path": "/health", + "port": 8080, + }, + "initialDelaySeconds": 3, + "periodSeconds": 3, + "type": "Liveness", + } + ], + "volumeMounts": [ + {"mountPath": "/mnt/path1", "subPath": "subPath1", "volumeName": "azurefile"}, + {"mountPath": "/mnt/path2", "subPath": "subPath2", "volumeName": "nfsazurefile"}, + ], + } + ], + "initContainers": [ + { + "args": ["-c", "while true; do echo hello; sleep 10;done"], + "command": ["/bin/sh"], + "image": "repo/testcontainerApp0:v4", + "name": "testinitcontainerApp0", + "resources": {"cpu": 0.2, "memory": "100Mi"}, + } + ], + "scale": { + "cooldownPeriod": 350, + "maxReplicas": 5, + "minReplicas": 1, + "pollingInterval": 35, + "rules": [ + { + "custom": {"metadata": {"concurrentRequests": "50"}, "type": "http"}, + "name": "httpscalingrule", + } + ], + }, + "serviceBinds": [ + { + "clientType": "dotnet", + "customizedKeys": {"DesiredKey": "defaultKey"}, + "name": "redisService", + "serviceId": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/containerApps/redisService", + } + ], + "volumes": [ + {"name": "azurefile", "storageName": "storage", "storageType": "AzureFile"}, + {"name": "nfsazurefile", "storageName": "nfsStorage", "storageType": "NfsAzureFile"}, + ], + }, + "workloadProfileName": "My-GP-01", + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/ContainerApps_SourceToCloudApp_CreateOrUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_start.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_start.py index 8cab72d6d371..34cf8de82eba 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_start.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_start.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -32,11 +33,11 @@ def main(): response = client.container_apps.begin_start( resource_group_name="rg", - container_app_name="testworkerapp0", + container_app_name="testWorkerApp0", ).result() print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/ContainerApps_Start.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/ContainerApps_Start.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_stop.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_stop.py index 51cc6db16b48..15cc6ca349cd 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_stop.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_stop.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -32,11 +33,11 @@ def main(): response = client.container_apps.begin_stop( resource_group_name="rg", - container_app_name="testworkerApp0", + container_app_name="testWorkerApp0", ).result() print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/ContainerApps_Stop.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-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 2967da7ed1fc..2c4bab79b1e5 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -32,7 +33,7 @@ def main(): response = client.container_apps.begin_create_or_update( resource_group_name="rg", - container_app_name="testcontainerapptcp", + container_app_name="testcontainerAppTcp", container_app_envelope={ "location": "East US", "properties": { @@ -41,7 +42,7 @@ def main(): "exposedPort": 4000, "external": True, "targetPort": 3000, - "traffic": [{"revisionName": "testcontainerapptcp-ab1234", "weight": 100}], + "traffic": [{"revisionName": "testcontainerAppTcp-ab1234", "weight": 100}], "transport": "tcp", } }, @@ -49,8 +50,8 @@ def main(): "template": { "containers": [ { - "image": "repo/testcontainerapptcp:v1", - "name": "testcontainerapptcp", + "image": "repo/testcontainerAppTcp:v1", + "name": "testcontainerAppTcp", "probes": [ { "initialDelaySeconds": 3, @@ -75,6 +76,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/ContainerApps_TcpApp_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/ContainerApps_TcpApp_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policies_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policies_delete.py new file mode 100644 index 000000000000..4aa9830eb628 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policies_delete.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python dapr_component_resiliency_policies_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + client.dapr_component_resiliency_policies.delete( + resource_group_name="examplerg", + environment_name="myenvironment", + component_name="mydaprcomponent", + name="myresiliencypolicy", + ) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/DaprComponentResiliencyPolicies_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policies_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policies_get.py new file mode 100644 index 000000000000..b88a79bf2458 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policies_get.py @@ -0,0 +1,45 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python dapr_component_resiliency_policies_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.dapr_component_resiliency_policies.get( + resource_group_name="examplerg", + environment_name="myenvironment", + component_name="mydaprcomponent", + name="myresiliencypolicy", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/DaprComponentResiliencyPolicies_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policies_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policies_list.py new file mode 100644 index 000000000000..a236511ef3de --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policies_list.py @@ -0,0 +1,45 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python dapr_component_resiliency_policies_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.dapr_component_resiliency_policies.list( + resource_group_name="examplerg", + environment_name="myenvironment", + component_name="mydaprcomponent", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/DaprComponentResiliencyPolicies_List.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policy_create_or_update_all_options.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policy_create_or_update_all_options.py new file mode 100644 index 000000000000..23a787bb8d1d --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policy_create_or_update_all_options.py @@ -0,0 +1,65 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python dapr_component_resiliency_policy_create_or_update_all_options.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.dapr_component_resiliency_policies.create_or_update( + resource_group_name="examplerg", + environment_name="myenvironment", + component_name="mydaprcomponent", + name="myresiliencypolicy", + dapr_component_resiliency_policy_envelope={ + "properties": { + "inboundPolicy": { + "circuitBreakerPolicy": {"consecutiveErrors": 5, "intervalInSeconds": 4, "timeoutInSeconds": 10}, + "httpRetryPolicy": { + "maxRetries": 15, + "retryBackOff": {"initialDelayInMilliseconds": 2000, "maxIntervalInMilliseconds": 5500}, + }, + "timeoutPolicy": {"responseTimeoutInSeconds": 30}, + }, + "outboundPolicy": { + "circuitBreakerPolicy": {"consecutiveErrors": 3, "intervalInSeconds": 60, "timeoutInSeconds": 20}, + "httpRetryPolicy": { + "maxRetries": 5, + "retryBackOff": {"initialDelayInMilliseconds": 100, "maxIntervalInMilliseconds": 30000}, + }, + "timeoutPolicy": {"responseTimeoutInSeconds": 12}, + }, + } + }, + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/DaprComponentResiliencyPolicy_CreateOrUpdate_AllOptions.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policy_create_or_update_outbound_only.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policy_create_or_update_outbound_only.py new file mode 100644 index 000000000000..338b920ca0aa --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policy_create_or_update_outbound_only.py @@ -0,0 +1,57 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python dapr_component_resiliency_policy_create_or_update_outbound_only.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.dapr_component_resiliency_policies.create_or_update( + resource_group_name="examplerg", + environment_name="myenvironment", + component_name="mydaprcomponent", + name="myresiliencypolicy", + dapr_component_resiliency_policy_envelope={ + "properties": { + "outboundPolicy": { + "circuitBreakerPolicy": {"consecutiveErrors": 3, "intervalInSeconds": 60, "timeoutInSeconds": 20}, + "httpRetryPolicy": { + "maxRetries": 5, + "retryBackOff": {"initialDelayInMilliseconds": 100, "maxIntervalInMilliseconds": 30000}, + }, + "timeoutPolicy": {"responseTimeoutInSeconds": 12}, + } + } + }, + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/DaprComponentResiliencyPolicy_CreateOrUpdate_OutboundOnly.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policy_create_or_update_sparse_options.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policy_create_or_update_sparse_options.py new file mode 100644 index 000000000000..9e28dd545e7c --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policy_create_or_update_sparse_options.py @@ -0,0 +1,57 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python dapr_component_resiliency_policy_create_or_update_sparse_options.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.dapr_component_resiliency_policies.create_or_update( + resource_group_name="examplerg", + environment_name="myenvironment", + component_name="mydaprcomponent", + name="myresiliencypolicy", + dapr_component_resiliency_policy_envelope={ + "properties": { + "inboundPolicy": { + "circuitBreakerPolicy": {"consecutiveErrors": 3, "timeoutInSeconds": 20}, + "httpRetryPolicy": { + "maxRetries": 5, + "retryBackOff": {"initialDelayInMilliseconds": 2000, "maxIntervalInMilliseconds": 5500}, + }, + }, + "outboundPolicy": {"timeoutPolicy": {"responseTimeoutInSeconds": 12}}, + } + }, + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/DaprComponentResiliencyPolicy_CreateOrUpdate_SparseOptions.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_create_or_update_secret_store_component.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_create_or_update_secret_store_component.py index 16b47465b1e2..e34ac4d318d8 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -47,6 +48,13 @@ def main(): ], "scopes": ["container-app-1", "container-app-2"], "secretStoreComponent": "my-secret-store", + "serviceComponentBind": [ + { + "metadata": {"name": "daprcomponentBind", "value": "redis-bind"}, + "name": "statestore", + "serviceId": "/subscriptions/9f7371f1-b593-4c3c-84e2-9167806ad358/resourceGroups/ca-syn2-group/providers/Microsoft.App/containerapps/cappredis", + } + ], "version": "v1", } }, @@ -54,6 +62,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/DaprComponents_CreateOrUpdate_SecretStoreComponent.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-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 907f039c81cf..5d06f1e0bc11 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -47,6 +48,13 @@ def main(): ], "scopes": ["container-app-1", "container-app-2"], "secrets": [{"name": "masterkey", "value": "keyvalue"}], + "serviceComponentBind": [ + { + "metadata": {"name": "daprcomponentBind", "value": "redis-bind"}, + "name": "statestore", + "serviceId": "/subscriptions/9f7371f1-b593-4c3c-84e2-9167806ad358/resourceGroups/ca-syn2-group/providers/Microsoft.App/containerapps/cappredis", + } + ], "version": "v1", } }, @@ -54,6 +62,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/DaprComponents_CreateOrUpdate_Secrets.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-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 19ac68952456..c12cc258e0be 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,6 @@ def main(): ) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/DaprComponents_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-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 d0103315f147..a28d72250455 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/DaprComponents_Get_SecretStoreComponent.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-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 e14a9a46a900..77548ed7ad1c 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/DaprComponents_Get_Secrets.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-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 76f45340747b..3602646cb6d0 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/DaprComponents_List.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-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 336caa930d96..2425eb667a6a 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/DaprComponents_ListSecrets.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/DaprComponents_ListSecrets.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_create_or_update_bulk_subscribe_and_scopes.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_create_or_update_bulk_subscribe_and_scopes.py new file mode 100644 index 000000000000..5e561d5a4187 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_create_or_update_bulk_subscribe_and_scopes.py @@ -0,0 +1,53 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python dapr_subscriptions_create_or_update_bulk_subscribe_and_scopes.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.dapr_subscriptions.create_or_update( + resource_group_name="examplerg", + environment_name="myenvironment", + name="mysubscription", + dapr_subscription_envelope={ + "properties": { + "bulkSubscribe": {"enabled": True, "maxAwaitDurationMs": 500, "maxMessagesCount": 123}, + "pubsubName": "mypubsubcomponent", + "routes": {"default": "/products"}, + "scopes": ["warehouseapp", "customersupportapp"], + "topic": "inventory", + } + }, + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/DaprSubscriptions_CreateOrUpdate_BulkSubscribeAndScopes.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_create_or_update_default_route.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_create_or_update_default_route.py new file mode 100644 index 000000000000..7d78c2b2ddc7 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_create_or_update_default_route.py @@ -0,0 +1,47 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python dapr_subscriptions_create_or_update_default_route.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.dapr_subscriptions.create_or_update( + resource_group_name="examplerg", + environment_name="myenvironment", + name="mysubscription", + dapr_subscription_envelope={ + "properties": {"pubsubName": "mypubsubcomponent", "routes": {"default": "/products"}, "topic": "inventory"} + }, + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/DaprSubscriptions_CreateOrUpdate_DefaultRoute.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_create_or_update_route_rules_and_metadata.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_create_or_update_route_rules_and_metadata.py new file mode 100644 index 000000000000..9575da8e0f51 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_create_or_update_route_rules_and_metadata.py @@ -0,0 +1,58 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python dapr_subscriptions_create_or_update_route_rules_and_metadata.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.dapr_subscriptions.create_or_update( + resource_group_name="examplerg", + environment_name="myenvironment", + name="mysubscription", + dapr_subscription_envelope={ + "properties": { + "metadata": {"foo": "bar", "hello": "world"}, + "pubsubName": "mypubsubcomponent", + "routes": { + "default": "/products", + "rules": [ + {"match": "event.type == 'widget'", "path": "/widgets"}, + {"match": "event.type == 'gadget'", "path": "/gadgets"}, + ], + }, + "topic": "inventory", + } + }, + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/DaprSubscriptions_CreateOrUpdate_RouteRulesAndMetadata.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_delete.py new file mode 100644 index 000000000000..8286296b3a9c --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_delete.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python dapr_subscriptions_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + client.dapr_subscriptions.delete( + resource_group_name="examplerg", + environment_name="myenvironment", + name="mysubscription", + ) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/DaprSubscriptions_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_get_bulk_subscribe_and_scopes.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_get_bulk_subscribe_and_scopes.py new file mode 100644 index 000000000000..64f1a9084a8b --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_get_bulk_subscribe_and_scopes.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python dapr_subscriptions_get_bulk_subscribe_and_scopes.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.dapr_subscriptions.get( + resource_group_name="examplerg", + environment_name="myenvironment", + name="mypubsubcomponent", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/DaprSubscriptions_Get_BulkSubscribeAndScopes.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_get_default_route.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_get_default_route.py new file mode 100644 index 000000000000..ce1de927e7a7 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_get_default_route.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python dapr_subscriptions_get_default_route.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.dapr_subscriptions.get( + resource_group_name="examplerg", + environment_name="myenvironment", + name="mypubsubcomponent", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/DaprSubscriptions_Get_DefaultRoute.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_get_route_rules_and_metadata.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_get_route_rules_and_metadata.py new file mode 100644 index 000000000000..1d5b3691443e --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_get_route_rules_and_metadata.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python dapr_subscriptions_get_route_rules_and_metadata.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.dapr_subscriptions.get( + resource_group_name="examplerg", + environment_name="myenvironment", + name="mypubsubcomponent", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/DaprSubscriptions_Get_RouteRulesAndMetadata.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_list.py new file mode 100644 index 000000000000..fbdcbc52dcc8 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_list.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python dapr_subscriptions_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.dapr_subscriptions.list( + resource_group_name="examplerg", + environment_name="myenvironment", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/DaprSubscriptions_List.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_create_or_update.py new file mode 100644 index 000000000000..cde394a7bc48 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_create_or_update.py @@ -0,0 +1,50 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python dot_net_components_create_or_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.dot_net_components.begin_create_or_update( + resource_group_name="examplerg", + environment_name="myenvironment", + name="mydotnetcomponent", + dot_net_component_envelope={ + "properties": { + "componentType": "AspireDashboard", + "configurations": [{"propertyName": "dashboard-theme", "value": "dark"}], + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/DotNetComponents_CreateOrUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_create_or_update_service_bind.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_create_or_update_service_bind.py new file mode 100644 index 000000000000..939b8c800e62 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_create_or_update_service_bind.py @@ -0,0 +1,56 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python dot_net_components_create_or_update_service_bind.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.dot_net_components.begin_create_or_update( + resource_group_name="examplerg", + environment_name="myenvironment", + name="mydotnetcomponent", + dot_net_component_envelope={ + "properties": { + "componentType": "AspireDashboard", + "configurations": [{"propertyName": "dashboard-theme", "value": "dark"}], + "serviceBinds": [ + { + "name": "yellowcat", + "serviceId": "/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/myenvironment/dotNetComponents/yellowcat", + } + ], + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/DotNetComponents_CreateOrUpdate_ServiceBind.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_delete.py new file mode 100644 index 000000000000..8408f384567c --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_delete.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python dot_net_components_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + client.dot_net_components.begin_delete( + resource_group_name="examplerg", + environment_name="myenvironment", + name="mydotnetcomponent", + ).result() + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/DotNetComponents_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_get.py new file mode 100644 index 000000000000..b178cd392f6b --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_get.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python dot_net_components_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.dot_net_components.get( + resource_group_name="examplerg", + environment_name="myenvironment", + name="mydotnetcomponent", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/DotNetComponents_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_get_service_bind.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_get_service_bind.py new file mode 100644 index 000000000000..4a892d2163f3 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_get_service_bind.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python dot_net_components_get_service_bind.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.dot_net_components.get( + resource_group_name="examplerg", + environment_name="myenvironment", + name="mydotnetcomponent", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/DotNetComponents_Get_ServiceBind.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_list.py new file mode 100644 index 000000000000..269aec68a2bf --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_list.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python dot_net_components_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.dot_net_components.list( + resource_group_name="examplerg", + environment_name="myenvironment", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/DotNetComponents_List.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_list_service_bind.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_list_service_bind.py new file mode 100644 index 000000000000..32b1a18c4905 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_list_service_bind.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python dot_net_components_list_service_bind.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.dot_net_components.list( + resource_group_name="examplerg", + environment_name="myenvironment", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/DotNetComponents_List_ServiceBind.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_patch.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_patch.py new file mode 100644 index 000000000000..b13fdff30109 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_patch.py @@ -0,0 +1,50 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python dot_net_components_patch.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.dot_net_components.begin_update( + resource_group_name="examplerg", + environment_name="myenvironment", + name="mydotnetcomponent", + dot_net_component_envelope={ + "properties": { + "componentType": "AspireDashboard", + "configurations": [{"propertyName": "dashboard-theme", "value": "dark"}], + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/DotNetComponents_Patch.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_patch_service_bind.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_patch_service_bind.py new file mode 100644 index 000000000000..96264471c90f --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_patch_service_bind.py @@ -0,0 +1,56 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python dot_net_components_patch_service_bind.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.dot_net_components.begin_update( + resource_group_name="examplerg", + environment_name="myenvironment", + name="mydotnetcomponent", + dot_net_component_envelope={ + "properties": { + "componentType": "AspireDashboard", + "configurations": [{"propertyName": "dashboard-theme", "value": "dark"}], + "serviceBinds": [ + { + "name": "yellowcat", + "serviceId": "/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/myenvironment/dotNetComponents/yellowcat", + } + ], + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/DotNetComponents_Patch_ServiceBind.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/functions_extension_post.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/functions_extension_post.py new file mode 100644 index 000000000000..4249ba960e2e --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/functions_extension_post.py @@ -0,0 +1,45 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python functions_extension_post.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + response = client.functions_extension.invoke_functions_host( + resource_group_name="rg", + container_app_name="testcontainerApp0", + revision_name="testcontainerApp0-pjxhsye", + function_app_name="testcontainerApp0", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/FunctionsExtension_Post.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/http_route_config_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/http_route_config_create_or_update.py new file mode 100644 index 000000000000..607a8512960d --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/http_route_config_create_or_update.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python http_route_config_create_or_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + response = client.http_route_config.create_or_update( + resource_group_name="examplerg", + environment_name="testcontainerenv", + http_route_name="httproutefriendlyname", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/HttpRouteConfig_CreateOrUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/http_route_config_create_or_update_path_sep_prefix.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/http_route_config_create_or_update_path_sep_prefix.py new file mode 100644 index 000000000000..0938141b409b --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/http_route_config_create_or_update_path_sep_prefix.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python http_route_config_create_or_update_path_sep_prefix.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + response = client.http_route_config.create_or_update( + resource_group_name="examplerg", + environment_name="testcontainerenv", + http_route_name="httproutefriendlyname", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/HttpRouteConfig_CreateOrUpdate_PathSepPrefix.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/http_route_config_create_or_update_prefix.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/http_route_config_create_or_update_prefix.py new file mode 100644 index 000000000000..99158ac56d5e --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/http_route_config_create_or_update_prefix.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python http_route_config_create_or_update_prefix.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + response = client.http_route_config.create_or_update( + resource_group_name="examplerg", + environment_name="testcontainerenv", + http_route_name="httproutefriendlyname", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/HttpRouteConfig_CreateOrUpdatePrefix.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/http_route_config_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/http_route_config_delete.py new file mode 100644 index 000000000000..6b1b0668e554 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/http_route_config_delete.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python http_route_config_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + client.http_route_config.delete( + resource_group_name="examplerg", + environment_name="testcontainerenv", + http_route_name="httproutefriendlyname", + ) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/HttpRouteConfig_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/http_route_config_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/http_route_config_get.py new file mode 100644 index 000000000000..dafff3297e49 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/http_route_config_get.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python http_route_config_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + response = client.http_route_config.get( + resource_group_name="examplerg", + environment_name="testcontainerenv", + http_route_name="httproutefriendlyname", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/HttpRouteConfig_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/http_route_config_list_by_managed_environment.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/http_route_config_list_by_managed_environment.py new file mode 100644 index 000000000000..b0576621925e --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/http_route_config_list_by_managed_environment.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python http_route_config_list_by_managed_environment.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + response = client.http_route_config.list( + resource_group_name="examplerg", + environment_name="testcontainerenv", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/HttpRouteConfig_ListByManagedEnvironment.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/http_route_config_patch.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/http_route_config_patch.py new file mode 100644 index 000000000000..01e0add527bb --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/http_route_config_patch.py @@ -0,0 +1,64 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python http_route_config_patch.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + response = client.http_route_config.update( + resource_group_name="examplerg", + environment_name="testcontainerenv", + http_route_name="httproutefriendlyname", + http_route_config_envelope={ + "properties": { + "customDomains": [ + { + "bindingType": "SniEnabled", + "certificateId": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/testcontainerenv/certificates/certificate-1", + "name": "example.com", + } + ], + "rules": [ + { + "description": "random-description", + "routes": [ + {"action": {"prefixRewrite": "/v1/api"}, "match": {"caseSensitive": True, "path": "/v1"}} + ], + "targets": [{"containerApp": "capp-1", "revision": "rev-1", "weight": 100}], + } + ], + } + }, + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/HttpRouteConfig_Patch.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_create_or_update.py index 63e0d53e9700..03ae865462c5 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_create_or_update.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_create_or_update.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -48,6 +49,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/JavaComponents_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/JavaComponents_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_create_or_update_service_bind.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_create_or_update_service_bind.py index 6c9f17e490b6..60d9f5562a55 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_create_or_update_service_bind.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_create_or_update_service_bind.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -54,6 +55,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/JavaComponents_CreateOrUpdate_ServiceBind.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/JavaComponents_CreateOrUpdate_ServiceBind.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_delete.py index b5cc10d3cdea..2ef6100aedbf 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_delete.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_delete.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,6 @@ def main(): ).result() -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/JavaComponents_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/JavaComponents_Delete.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_get.py index ad66a5a0836d..28df0a670f87 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_get.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/JavaComponents_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/JavaComponents_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_get_service_bind.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_get_service_bind.py index ae4f2b531882..b8a965313575 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_get_service_bind.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_get_service_bind.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/JavaComponents_Get_ServiceBind.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/JavaComponents_Get_ServiceBind.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_list.py index 3d8a94aa9f31..e4985ef7cd0e 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_list.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_list.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/JavaComponents_List.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/JavaComponents_List.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_list_service_bind.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_list_service_bind.py index 880c89f4f68d..39ee4abb4fde 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_list_service_bind.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_list_service_bind.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/JavaComponents_List_ServiceBind.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/JavaComponents_List_ServiceBind.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_patch.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_patch.py index 073b0f3c587f..1f7611298528 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_patch.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_patch.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -48,6 +49,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/JavaComponents_Patch.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/JavaComponents_Patch.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_patch_service_bind.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_patch_service_bind.py index 64d03cfea58e..5d32d891f9d3 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_patch_service_bind.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_patch_service_bind.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -54,6 +55,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/JavaComponents_Patch_ServiceBind.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/JavaComponents_Patch_ServiceBind.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 71b9fc6a80aa..798cbb35eefc 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_delete.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_delete.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -32,10 +33,10 @@ def main(): client.jobs.begin_delete( resource_group_name="rg", - job_name="testworkercontainerappsjob0", + job_name="testWorkerContainerAppsJob0", ).result() -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/Job_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/Job_Delete.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_execution_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_execution_get.py index 6fa5c4800ec6..6d9b60293d81 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_execution_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_execution_get.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -32,12 +33,12 @@ def main(): response = client.job_execution( resource_group_name="rg", - job_name="testcontainerappsjob0", + job_name="testcontainerAppsJob0", job_execution_name="jobExecution1", ) print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/Job_Execution_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-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 d3189928a62e..96a8372428b2 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -32,12 +33,12 @@ def main(): response = client.jobs_executions.list( resource_group_name="rg", - job_name="testcontainerappsjob0", + job_name="testcontainerAppsJob0", ) for item in response: print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/Job_Executions_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-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 a3fc44344343..719bd945ac0e 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_get.py @@ -32,11 +32,11 @@ def main(): response = client.jobs.get( resource_group_name="rg", - job_name="testcontainerappsjob0", + job_name="testcontainerAppsJob0", ) print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/Job_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/Job_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_get_detector.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_get_detector.py index f4e1e1217211..917fa028496d 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_get_detector.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_get_detector.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/Job_GetDetector.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/Job_GetDetector.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_list_detectors.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_list_detectors.py index 95d09ed0dc3b..7e6851de4200 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_list_detectors.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_list_detectors.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/Job_ListDetectors.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/Job_ListDetectors.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_list_secrets.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_list_secrets.py index 22a547c831eb..990bdefbdc12 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -32,11 +33,11 @@ def main(): response = client.jobs.list_secrets( resource_group_name="rg", - job_name="testcontainerappsjob0", + job_name="testcontainerAppsJob0", ) print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/Job_ListSecrets.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/Job_ListSecrets.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_proxy_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_proxy_get.py index af7cc41c4a6c..ff9977de3f69 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_proxy_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_proxy_get.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -32,12 +33,12 @@ def main(): response = client.jobs.proxy_get( resource_group_name="rg", - job_name="testcontainerappsjob0", + job_name="testcontainerAppsJob0", api_name="rootApi", ) print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/Job_ProxyGet.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/Job_ProxyGet.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_start.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_start.py index 38312b3441a1..c476c8906c66 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_start.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_start.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -32,11 +33,11 @@ def main(): response = client.jobs.begin_start( resource_group_name="rg", - job_name="testcontainerappsjob0", + job_name="testcontainerAppsJob0", ).result() print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/Job_Start.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-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 12b75f09d0a5..fe3e104f07ba 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -32,11 +33,11 @@ def main(): client.jobs.begin_stop_execution( resource_group_name="rg", - job_name="testcontainerappsjob0", + job_name="testcontainerAppsJob0", job_execution_name="jobExecution1", ).result() -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/Job_Stop_Execution.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-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 58d4b2b90ee1..4eda466eb419 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -32,11 +33,11 @@ def main(): response = client.jobs.begin_stop_multiple_executions( resource_group_name="rg", - job_name="testcontainerappsjob0", + job_name="testcontainerAppsJob0", ).result() print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/Job_Stop_Multiple.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-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 fdfe2533a7b6..5ce59a6aedae 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/Jobs_ListByResourceGroup.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-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 3f25481775a7..708ef475761f 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -35,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/Jobs_ListBySubscription.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/Jobs_ListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/jobs_resume.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/jobs_resume.py new file mode 100644 index 000000000000..c7b66d7a6c99 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/jobs_resume.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python jobs_resume.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + response = client.jobs.begin_resume( + resource_group_name="rg", + job_name="testcontainerAppsJob0", + ).result() + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/Jobs_Resume.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/jobs_suspend.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/jobs_suspend.py new file mode 100644 index 000000000000..8293faab4385 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/jobs_suspend.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python jobs_suspend.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + response = client.jobs.begin_suspend( + resource_group_name="rg", + job_name="testcontainerAppsJob0", + ).result() + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/Jobs_Suspend.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/label_history_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/label_history_delete.py new file mode 100644 index 000000000000..c9a5d365fe81 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/label_history_delete.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python label_history_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + client.container_apps_label_history.delete_label_history( + resource_group_name="rg", + container_app_name="testContainerApp", + label_name="dev", + ) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/LabelHistory_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/label_history_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/label_history_get.py new file mode 100644 index 000000000000..e0cc98dfe207 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/label_history_get.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python label_history_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + response = client.container_apps_label_history.get_label_history( + resource_group_name="rg", + container_app_name="testContainerApp", + label_name="dev", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/LabelHistory_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/label_history_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/label_history_list.py new file mode 100644 index 000000000000..2fcc2e0d70a6 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/label_history_list.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python label_history_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + response = client.container_apps_label_history.list_label_history( + resource_group_name="rg", + container_app_name="testContainerApp", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/LabelHistory_List.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_create.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_create.py new file mode 100644 index 000000000000..4ea1e48c84b0 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_create.py @@ -0,0 +1,45 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python logic_apps_create.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.logic_apps.create_or_update( + resource_group_name="examplerg", + container_app_name="testcontainerApp0", + logic_app_name="testcontainerApp0", + resource={"properties": {}}, + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/LogicApps_Create.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_delete.py new file mode 100644 index 000000000000..9d7a778f9efc --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_delete.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python logic_apps_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + client.logic_apps.delete( + resource_group_name="examplerg", + container_app_name="testcontainerApp0", + logic_app_name="testcontainerApp0", + ) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/LogicApps_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_delete_deploy_workflow_artifacts.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_delete_deploy_workflow_artifacts.py new file mode 100644 index 000000000000..545bcfac1ba4 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_delete_deploy_workflow_artifacts.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python logic_apps_delete_deploy_workflow_artifacts.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + client.logic_apps.deploy_workflow_artifacts( + resource_group_name="testrg123", + container_app_name="testapp2", + logic_app_name="testapp2", + ) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/LogicApps_DeleteDeployWorkflowArtifacts.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_get.py new file mode 100644 index 000000000000..6b557192f723 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_get.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python logic_apps_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.logic_apps.get( + resource_group_name="examplerg", + container_app_name="testcontainerApp0", + logic_app_name="testcontainerApp0", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/LogicApps_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_get_workflow.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_get_workflow.py new file mode 100644 index 000000000000..d184390af0dd --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_get_workflow.py @@ -0,0 +1,45 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python logic_apps_get_workflow.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.logic_apps.get_workflow( + resource_group_name="examplerg", + container_app_name="testcontainerApp0", + logic_app_name="testcontainerApp0", + workflow_name="stateful1", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/LogicApps_GetWorkflow.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_list_connections.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_list_connections.py new file mode 100644 index 000000000000..afe80e5bbf98 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_list_connections.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python logic_apps_list_connections.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + response = client.logic_apps.list_workflows_connections( + resource_group_name="testrg123", + container_app_name="testapp2", + logic_app_name="testapp2", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/LogicApps_ListConnections.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_list_workflows.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_list_workflows.py new file mode 100644 index 000000000000..afc4192d66ec --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_list_workflows.py @@ -0,0 +1,45 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python logic_apps_list_workflows.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.logic_apps.list_workflows( + resource_group_name="examplerg", + container_app_name="testcontainerApp0", + logic_app_name="testcontainerApp0", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/LogicApps_ListWorkflows.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_post_deploy_workflow_artifacts.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_post_deploy_workflow_artifacts.py new file mode 100644 index 000000000000..7fd1d64848a4 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_post_deploy_workflow_artifacts.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python logic_apps_post_deploy_workflow_artifacts.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + client.logic_apps.deploy_workflow_artifacts( + resource_group_name="testrg123", + container_app_name="testapp2", + logic_app_name="testapp2", + ) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/LogicApps_PostDeployWorkflowArtifacts.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificate_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificate_create_or_update.py index dbef2311317c..4ebcb6d146bb 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/ManagedCertificate_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-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 26c488f40f2e..2a680c40e0b4 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,6 @@ def main(): ) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/ManagedCertificate_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-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 6363cc973522..80621db4103a 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/ManagedCertificate_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-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 aa938ecc1d8c..77f6f27820af 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/ManagedCertificates_ListByManagedEnvironment.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-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 131b5969aa63..2bebf47f2c38 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -39,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/ManagedCertificates_Patch.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-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 37d1d55b79ed..2b19abec3459 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/ManagedEnvironmentDiagnostics_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-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 4175370c499c..5323e55d8645 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/ManagedEnvironmentDiagnostics_List.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/ManagedEnvironmentDiagnostics_List.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_maintenance_configurations_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_maintenance_configurations_create_or_update.py new file mode 100644 index 000000000000..866a19bf7727 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_maintenance_configurations_create_or_update.py @@ -0,0 +1,47 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python managed_environment_maintenance_configurations_create_or_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.maintenance_configurations.create_or_update( + resource_group_name="rg1", + environment_name="managedEnv", + config_name="default", + maintenance_configuration_envelope={ + "properties": {"scheduledEntries": [{"durationHours": 9, "startHourUtc": 12, "weekDay": "Sunday"}]} + }, + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/ManagedEnvironment_MaintenanceConfigurations_CreateOrUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_maintenance_configurations_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_maintenance_configurations_delete.py new file mode 100644 index 000000000000..875cab1b4166 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_maintenance_configurations_delete.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python managed_environment_maintenance_configurations_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + client.maintenance_configurations.delete( + resource_group_name="rg1", + environment_name="managedEnv", + config_name="default", + ) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/ManagedEnvironment_MaintenanceConfigurations_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_maintenance_configurations_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_maintenance_configurations_get.py new file mode 100644 index 000000000000..7bbda1cf8142 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_maintenance_configurations_get.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python managed_environment_maintenance_configurations_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.maintenance_configurations.get( + resource_group_name="rg1", + environment_name="managedEnv", + config_name="default", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/ManagedEnvironment_MaintenanceConfigurations_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_maintenance_configurations_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_maintenance_configurations_list.py new file mode 100644 index 000000000000..61bd11fb6e51 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_maintenance_configurations_list.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python managed_environment_maintenance_configurations_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.maintenance_configurations.list( + resource_group_name="rg1", + environment_name="managedEnv", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/ManagedEnvironment_MaintenanceConfigurations_List.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_private_endpoint_connections_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_private_endpoint_connections_create_or_update.py new file mode 100644 index 000000000000..d02b90f96295 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_private_endpoint_connections_create_or_update.py @@ -0,0 +1,47 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python managed_environment_private_endpoint_connections_create_or_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.managed_environment_private_endpoint_connections.begin_create_or_update( + resource_group_name="examplerg", + environment_name="managedEnv", + private_endpoint_connection_name="jlaw-demo1", + private_endpoint_connection_envelope={ + "properties": {"privateLinkServiceConnectionState": {"actionsRequired": "None", "status": "Approved"}} + }, + ).result() + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/ManagedEnvironmentPrivateEndpointConnections_CreateOrUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_private_endpoint_connections_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_private_endpoint_connections_delete.py new file mode 100644 index 000000000000..f3a7296247ff --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_private_endpoint_connections_delete.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python managed_environment_private_endpoint_connections_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + client.managed_environment_private_endpoint_connections.begin_delete( + resource_group_name="examplerg", + environment_name="managedEnv", + private_endpoint_connection_name="jlaw-demo1", + ).result() + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/ManagedEnvironmentPrivateEndpointConnections_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_private_endpoint_connections_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_private_endpoint_connections_get.py new file mode 100644 index 000000000000..1dd29f89a49a --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_private_endpoint_connections_get.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python managed_environment_private_endpoint_connections_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.managed_environment_private_endpoint_connections.get( + resource_group_name="examplerg", + environment_name="managedEnv", + private_endpoint_connection_name="jlaw-demo1", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/ManagedEnvironmentPrivateEndpointConnections_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_private_endpoint_connections_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_private_endpoint_connections_list.py new file mode 100644 index 000000000000..26fa092e9ffb --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_private_endpoint_connections_list.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python managed_environment_private_endpoint_connections_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.managed_environment_private_endpoint_connections.list( + resource_group_name="examplerg", + environment_name="managedEnv", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/ManagedEnvironmentPrivateEndpointConnections_List.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_private_link_resources_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_private_link_resources_list.py new file mode 100644 index 000000000000..9355a2feb9dd --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_private_link_resources_list.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python managed_environment_private_link_resources_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.managed_environment_private_link_resources.list( + resource_group_name="examplerg", + environment_name="managedEnv", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/ManagedEnvironmentPrivateLinkResources_List.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_usages_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_usages_list.py index 0016c3e63401..75a4b7900186 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_usages_list.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_usages_list.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/ManagedEnvironmentUsages_List.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/ManagedEnvironmentUsages_List.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_create_or_update.py index fed72944cc8c..c99e4903e510 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -42,13 +43,46 @@ def main(): }, "location": "East US", "properties": { - "appLogsConfiguration": {"logAnalyticsConfiguration": {"customerId": "string", "sharedKey": "string"}}, + "appInsightsConfiguration": { + "connectionString": "InstrumentationKey=00000000-0000-0000-0000-000000000000;IngestionEndpoint=https://eastus-8.in.applicationinsights.azure.com/;LiveEndpoint=https://eastus.livediagnostics.monitor.azure.com/" + }, + "appLogsConfiguration": { + "logAnalyticsConfiguration": { + "customerId": "string", + "dynamicJsonColumns": True, + "sharedKey": "string", + } + }, + "availabilityZones": ["1", "2", "3"], "customDomainConfiguration": { "certificatePassword": "1234", "certificateValue": "Y2VydA==", "dnsSuffix": "www.my-name.com", }, "daprAIConnectionString": "InstrumentationKey=00000000-0000-0000-0000-000000000000;IngestionEndpoint=https://northcentralus-0.in.applicationinsights.azure.com/", + "ingressConfiguration": { + "headerCountLimit": 30, + "requestIdleTimeout": 5, + "scale": {"maxReplicas": 4, "minReplicas": 2}, + "terminationGracePeriodSeconds": 3600, + "workloadProfileName": "My-CO-01", + }, + "openTelemetryConfiguration": { + "destinationsConfiguration": { + "dataDogConfiguration": {"key": "000000000000000000000000", "site": "string"}, + "otlpConfigurations": [ + { + "endpoint": "dashboard.k8s.region.azurecontainerapps.io:80", + "headers": [{"key": "api-key", "value": "xxxxxxxxxxx"}], + "insecure": True, + "name": "dashboard", + } + ], + }, + "logsConfiguration": {"destinations": ["appInsights"]}, + "metricsConfiguration": {"destinations": ["dataDog"], "includeKeda": True}, + "tracesConfiguration": {"destinations": ["appInsights"], "includeDapr": True}, + }, "peerAuthentication": {"mtls": {"enabled": True}}, "peerTrafficConfiguration": {"encryption": {"enabled": True}}, "vnetConfiguration": { @@ -56,6 +90,7 @@ def main(): }, "workloadProfiles": [ { + "enableFips": True, "maximumCount": 12, "minimumCount": 3, "name": "My-GP-01", @@ -82,6 +117,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/ManagedEnvironments_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-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 15a5bf1f7791..3ed17cfd223f 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,7 @@ def main(): "location": "East US", "properties": { "appLogsConfiguration": {"logAnalyticsConfiguration": {"customerId": "string", "sharedKey": "string"}}, + "availabilityZones": ["1", "2", "3"], "customDomainConfiguration": { "certificatePassword": "1234", "certificateValue": "Y2VydA==", @@ -49,6 +51,7 @@ def main(): }, "workloadProfiles": [ { + "enableFips": True, "maximumCount": 12, "minimumCount": 3, "name": "My-GP-01", @@ -75,6 +78,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/ManagedEnvironments_CustomInfrastructureResourceGroup_Create.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-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 c2730b198849..84ea4e8c1ba1 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -36,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/ManagedEnvironments_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-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 766110c4579f..971aee10b288 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -9,6 +10,7 @@ from azure.identity import DefaultAzureCredential from azure.mgmt.appcontainers import ContainerAppsAPIClient + """ # PREREQUISITES pip install azure-identity @@ -21,20 +23,21 @@ AZURE_CLIENT_SECRET. For more info about how to get the value, please see: https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal """ + + def main(): client = ContainerAppsAPIClient( credential=DefaultAzureCredential(), subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", ) - response = client.managed_environments.get( - resource_group_name='examplerg', - environment_name='jlaw-demo1', + response = client.managed_environments_diagnostics.get_root( + resource_group_name="examplerg", + environment_name="jlaw-demo1", ) print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/ManagedEnvironments_Get.json + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/ManagedEnvironments_Get.json if __name__ == "__main__": main() -n__": - main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_get_auth_token.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_get_auth_token.py index 47ff3ea362e3..56062e0a1caf 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/ManagedEnvironments_GetAuthToken.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-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 0bc799224b04..3ef911524519 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/ManagedEnvironments_ListByResourceGroup.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-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 6a07ac8369b1..29f01e91ea3c 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -35,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/ManagedEnvironments_ListBySubscription.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-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 cb54352bc5f9..207b8d35cf13 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/ManagedEnvironments_ListWorkloadProfileStates.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-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 772f6f38a293..6fd94b23d569 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/ManagedEnvironments_Patch.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-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 64f7d2adf80f..d50604fd2f75 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -48,6 +49,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/ManagedEnvironmentsStorages_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/ManagedEnvironmentsStorages_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_create_or_update_nfs_azure_file.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_create_or_update_nfs_azure_file.py index 54ab262e10dc..35ceac33530d 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_create_or_update_nfs_azure_file.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_create_or_update_nfs_azure_file.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -41,6 +42,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/ManagedEnvironmentsStorages_CreateOrUpdate_NfsAzureFile.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/ManagedEnvironmentsStorages_CreateOrUpdate_NfsAzureFile.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_delete.py index 3b5327d95b57..4409705e29fc 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,6 @@ def main(): ) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/ManagedEnvironmentsStorages_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-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 74e3995c96c9..a23b708848cf 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/ManagedEnvironmentsStorages_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/ManagedEnvironmentsStorages_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_get_nfs_azure_file.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_get_nfs_azure_file.py index 959d3302c98e..55b2fcd0e5c6 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_get_nfs_azure_file.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_get_nfs_azure_file.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/ManagedEnvironmentsStorages_Get_NfsAzureFile.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/ManagedEnvironmentsStorages_Get_NfsAzureFile.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_list.py index 6ee483edda79..c3e8db16c270 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/ManagedEnvironmentsStorages_List.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-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 9da550318741..39952bffab48 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/operations_list.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/operations_list.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -35,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/Operations_List.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-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 4d45a399094d..1b70971f4d8b 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/replicas_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/replicas_get.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -39,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/Replicas_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-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 07bd69f7497a..5d99eadbfd91 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/replicas_list.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/replicas_list.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/Replicas_List.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-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 ce059b20cd09..aac1a61e3314 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_activate.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_activate.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,6 @@ def main(): ) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/Revisions_Activate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-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 1271902d47fe..34706ec169f4 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_deactivate.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_deactivate.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,6 @@ def main(): ) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/Revisions_Deactivate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-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 4bc48fb920ad..2ad22195eab7 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_get.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -30,7 +31,7 @@ def main(): subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) - response = client.container_apps_diagnostics.get_revision( + response = client.container_apps_revisions.get_revision( resource_group_name="rg", container_app_name="testcontainerApp0", revision_name="testcontainerApp0-pjxhsye", @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/Revisions_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-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 95850c56385a..23153aa96493 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_list.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_list.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -30,7 +31,7 @@ def main(): subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) - response = client.container_apps_diagnostics.list_revisions( + response = client.container_apps_revisions.list_revisions( resource_group_name="rg", container_app_name="testcontainerApp0", ) @@ -38,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/Revisions_List.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-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 7373cf52aa20..f0305e1dec24 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_restart.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_restart.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,6 @@ def main(): ) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/Revisions_Restart.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/Revisions_Restart.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/session_pools_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/session_pools_delete.py index 0d0f0051d4b7..aa4174a48574 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/session_pools_delete.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/session_pools_delete.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -36,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/SessionPools_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/SessionPools_Delete.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/session_pools_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/session_pools_get.py index 7dd7366cabc2..f03ca08c01a4 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/session_pools_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/session_pools_get.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/SessionPools_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/SessionPools_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/session_pools_lifecycle_on_container_exit_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/session_pools_lifecycle_on_container_exit_create_or_update.py index 16ee8b790c7f..d8ff9bab6a2c 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/session_pools_lifecycle_on_container_exit_create_or_update.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/session_pools_lifecycle_on_container_exit_create_or_update.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -68,6 +69,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/SessionPools_LifecycleOnContainerExit_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/SessionPools_LifecycleOnContainerExit_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/session_pools_lifecycle_timed_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/session_pools_lifecycle_timed_create_or_update.py index 29b532b93ada..95f60c2f0fa2 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/session_pools_lifecycle_timed_create_or_update.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/session_pools_lifecycle_timed_create_or_update.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -55,7 +56,7 @@ def main(): }, }, "dynamicPoolConfiguration": { - "lifecycleConfiguration": {"lifecycleType": "OnContainerExit", "maxAlivePeriodInSeconds": 86400} + "lifecycleConfiguration": {"cooldownPeriodInSeconds": 600, "lifecycleType": "Timed"} }, "environmentId": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube", "managedIdentitySettings": [{"identity": "system", "lifecycle": "Main"}], @@ -68,6 +69,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/SessionPools_LifecycleTimed_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/SessionPools_LifecycleTimed_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/session_pools_list_by_resource_group.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/session_pools_list_by_resource_group.py index 82bc83c1755b..6b9e78a8a178 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/session_pools_list_by_resource_group.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/session_pools_list_by_resource_group.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/SessionPools_ListByResourceGroup.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/SessionPools_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/session_pools_list_by_subscription.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/session_pools_list_by_subscription.py index bacf5de3380a..2d077c94ba17 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/session_pools_list_by_subscription.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/session_pools_list_by_subscription.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -35,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/SessionPools_ListBySubscription.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/SessionPools_ListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/session_pools_patch.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/session_pools_patch.py index 080f474b613f..4e704c92f353 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/session_pools_patch.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/session_pools_patch.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -47,6 +48,9 @@ def main(): ], "ingress": {"targetPort": 80}, }, + "dynamicPoolConfiguration": { + "lifecycleConfiguration": {"cooldownPeriodInSeconds": 600, "lifecycleType": "Timed"} + }, "scaleConfiguration": {"maxConcurrentSessions": 500, "readySessionInstances": 100}, "sessionNetworkConfiguration": {"status": "EgressEnabled"}, } @@ -55,6 +59,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/SessionPools_Patch.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/SessionPools_Patch.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/source_controls_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/source_controls_create_or_update.py index 4e36f63339f7..8b686ab6906b 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -44,7 +45,9 @@ def main(): "kind": "feaderated", "tenantId": "", }, + "buildEnvironmentVariables": [{"name": "foo1", "value": "bar1"}, {"name": "foo2", "value": "bar2"}], "contextPath": "./", + "dockerfilePath": "./Dockerfile", "githubPersonalAccessToken": "test", "image": "image/tag", "registryInfo": { @@ -60,6 +63,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/SourceControls_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-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 5644a664be66..88b5678c4a20 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,6 @@ def main(): ).result() -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/SourceControls_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-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 f60ae4f0994a..9b2ba08c3849 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/SourceControls_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-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 bf652250e9c8..34327f7f5f94 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/SourceControls_ListByContainer.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/SourceControls_ListByContainer.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/subscriptions_get_custom_domain_verification_id.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/subscriptions_get_custom_domain_verification_id.py index 1ae469b8a678..8dd9cb004741 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/subscriptions_get_custom_domain_verification_id.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/subscriptions_get_custom_domain_verification_id.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -34,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/Subscriptions_GetCustomDomainVerificationId.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/Subscriptions_GetCustomDomainVerificationId.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/usages_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/usages_list.py index 4c263a58cb52..9b14bdf5278f 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/usages_list.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/usages_list.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2025-01-01/examples/Usages_List.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2025-02-02-preview/examples/Usages_List.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api.py index 33b1fd8d5efa..508eacc41f89 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api.py @@ -25,7 +25,7 @@ def test_job_execution(self, resource_group): resource_group_name=resource_group.name, job_name="str", job_execution_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -35,7 +35,7 @@ def test_job_execution(self, resource_group): @recorded_by_proxy def test_get_custom_domain_verification_id(self, resource_group): response = self.client.get_custom_domain_verification_id( - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_app_resiliency_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_app_resiliency_operations.py index 54644f94f304..7ef4475f3088 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_app_resiliency_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_app_resiliency_operations.py @@ -20,7 +20,7 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_create_or_update(self, resource_group): + def test_app_resiliency_create_or_update(self, resource_group): response = self.client.app_resiliency.create_or_update( resource_group_name=resource_group.name, app_name="str", @@ -59,7 +59,7 @@ def test_create_or_update(self, resource_group): "timeoutPolicy": {"connectionTimeoutInSeconds": 0, "responseTimeoutInSeconds": 0}, "type": "str", }, - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -67,7 +67,7 @@ def test_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_update(self, resource_group): + def test_app_resiliency_update(self, resource_group): response = self.client.app_resiliency.update( resource_group_name=resource_group.name, app_name="str", @@ -106,7 +106,7 @@ def test_update(self, resource_group): "timeoutPolicy": {"connectionTimeoutInSeconds": 0, "responseTimeoutInSeconds": 0}, "type": "str", }, - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -114,12 +114,12 @@ def test_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_delete(self, resource_group): + def test_app_resiliency_delete(self, resource_group): response = self.client.app_resiliency.delete( resource_group_name=resource_group.name, app_name="str", name="str", - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -127,12 +127,12 @@ def test_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_app_resiliency_get(self, resource_group): response = self.client.app_resiliency.get( resource_group_name=resource_group.name, app_name="str", name="str", - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -140,11 +140,11 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list(self, resource_group): + def test_app_resiliency_list(self, resource_group): response = self.client.app_resiliency.list( resource_group_name=resource_group.name, app_name="str", - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_app_resiliency_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_app_resiliency_operations_async.py index ff4be53d4302..90ee2826964d 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_app_resiliency_operations_async.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_app_resiliency_operations_async.py @@ -21,7 +21,7 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_create_or_update(self, resource_group): + async def test_app_resiliency_create_or_update(self, resource_group): response = await self.client.app_resiliency.create_or_update( resource_group_name=resource_group.name, app_name="str", @@ -60,7 +60,7 @@ async def test_create_or_update(self, resource_group): "timeoutPolicy": {"connectionTimeoutInSeconds": 0, "responseTimeoutInSeconds": 0}, "type": "str", }, - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -68,7 +68,7 @@ async def test_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_update(self, resource_group): + async def test_app_resiliency_update(self, resource_group): response = await self.client.app_resiliency.update( resource_group_name=resource_group.name, app_name="str", @@ -107,7 +107,7 @@ async def test_update(self, resource_group): "timeoutPolicy": {"connectionTimeoutInSeconds": 0, "responseTimeoutInSeconds": 0}, "type": "str", }, - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -115,12 +115,12 @@ async def test_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_delete(self, resource_group): + async def test_app_resiliency_delete(self, resource_group): response = await self.client.app_resiliency.delete( resource_group_name=resource_group.name, app_name="str", name="str", - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -128,12 +128,12 @@ async def test_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_app_resiliency_get(self, resource_group): response = await self.client.app_resiliency.get( resource_group_name=resource_group.name, app_name="str", name="str", - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -141,11 +141,11 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list(self, resource_group): + async def test_app_resiliency_list(self, resource_group): response = self.client.app_resiliency.list( resource_group_name=resource_group.name, app_name="str", - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_async.py index 684dbf7e46bb..6fcf607e8173 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_async.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_async.py @@ -26,7 +26,7 @@ async def test_job_execution(self, resource_group): resource_group_name=resource_group.name, job_name="str", job_execution_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -36,7 +36,7 @@ async def test_job_execution(self, resource_group): @recorded_by_proxy_async async def test_get_custom_domain_verification_id(self, resource_group): response = await self.client.get_custom_domain_verification_id( - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_available_workload_profiles_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_available_workload_profiles_operations.py index e479bffcac29..0d1a0d9f6649 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_available_workload_profiles_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_available_workload_profiles_operations.py @@ -23,7 +23,7 @@ def setup_method(self, method): def test_available_workload_profiles_get(self, resource_group): response = self.client.available_workload_profiles.get( location="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_available_workload_profiles_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_available_workload_profiles_operations_async.py index 49bfee6f61ff..d0526c8fb921 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_available_workload_profiles_operations_async.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_available_workload_profiles_operations_async.py @@ -24,7 +24,7 @@ def setup_method(self, method): async def test_available_workload_profiles_get(self, resource_group): response = self.client.available_workload_profiles.get( location="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_billing_meters_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_billing_meters_operations.py index 284ffaa8aa23..a1ffcb256512 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_billing_meters_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_billing_meters_operations.py @@ -23,7 +23,7 @@ def setup_method(self, method): def test_billing_meters_get(self, resource_group): response = self.client.billing_meters.get( location="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_billing_meters_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_billing_meters_operations_async.py index d4dc3d9cb717..0a1364b9d5f7 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_billing_meters_operations_async.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_billing_meters_operations_async.py @@ -24,7 +24,7 @@ def setup_method(self, method): async def test_billing_meters_get(self, resource_group): response = await self.client.billing_meters.get( location="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_build_auth_token_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_build_auth_token_operations.py index d042638f1658..d035ccb4be43 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_build_auth_token_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_build_auth_token_operations.py @@ -20,12 +20,12 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list(self, resource_group): + def test_build_auth_token_list(self, resource_group): response = self.client.build_auth_token.list( resource_group_name=resource_group.name, builder_name="str", build_name="str", - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_build_auth_token_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_build_auth_token_operations_async.py index c318505cab15..f895422ba13f 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_build_auth_token_operations_async.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_build_auth_token_operations_async.py @@ -21,12 +21,12 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list(self, resource_group): + async def test_build_auth_token_list(self, resource_group): response = await self.client.build_auth_token.list( resource_group_name=resource_group.name, builder_name="str", build_name="str", - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_builders_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_builders_operations.py index bf0aa1457acc..4ab8d0c3e827 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_builders_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_builders_operations.py @@ -20,9 +20,9 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_by_subscription(self, resource_group): + def test_builders_list_by_subscription(self, resource_group): response = self.client.builders.list_by_subscription( - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -30,10 +30,10 @@ def test_list_by_subscription(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_by_resource_group(self, resource_group): + def test_builders_list_by_resource_group(self, resource_group): response = self.client.builders.list_by_resource_group( resource_group_name=resource_group.name, - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -41,11 +41,11 @@ def test_list_by_resource_group(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_builders_get(self, resource_group): response = self.client.builders.get( resource_group_name=resource_group.name, builder_name="str", - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -53,7 +53,7 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_create_or_update(self, resource_group): + def test_builders_begin_create_or_update(self, resource_group): response = self.client.builders.begin_create_or_update( resource_group_name=resource_group.name, builder_name="str", @@ -81,7 +81,7 @@ def test_begin_create_or_update(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -89,7 +89,7 @@ def test_begin_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_update(self, resource_group): + def test_builders_begin_update(self, resource_group): response = self.client.builders.begin_update( resource_group_name=resource_group.name, builder_name="str", @@ -103,7 +103,7 @@ def test_begin_update(self, resource_group): }, "tags": {"str": "str"}, }, - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -111,11 +111,11 @@ def test_begin_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_delete(self, resource_group): + def test_builders_begin_delete(self, resource_group): response = self.client.builders.begin_delete( resource_group_name=resource_group.name, builder_name="str", - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_builders_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_builders_operations_async.py index 22c6c7970201..e1a54bbceb53 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_builders_operations_async.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_builders_operations_async.py @@ -21,9 +21,9 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_by_subscription(self, resource_group): + async def test_builders_list_by_subscription(self, resource_group): response = self.client.builders.list_by_subscription( - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -31,10 +31,10 @@ async def test_list_by_subscription(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_by_resource_group(self, resource_group): + async def test_builders_list_by_resource_group(self, resource_group): response = self.client.builders.list_by_resource_group( resource_group_name=resource_group.name, - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -42,11 +42,11 @@ async def test_list_by_resource_group(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_builders_get(self, resource_group): response = await self.client.builders.get( resource_group_name=resource_group.name, builder_name="str", - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -54,7 +54,7 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_create_or_update(self, resource_group): + async def test_builders_begin_create_or_update(self, resource_group): response = await ( await self.client.builders.begin_create_or_update( resource_group_name=resource_group.name, @@ -83,7 +83,7 @@ async def test_begin_create_or_update(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ) ).result() # call '.result()' to poll until service return final result @@ -92,7 +92,7 @@ async def test_begin_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_update(self, resource_group): + async def test_builders_begin_update(self, resource_group): response = await ( await self.client.builders.begin_update( resource_group_name=resource_group.name, @@ -107,7 +107,7 @@ async def test_begin_update(self, resource_group): }, "tags": {"str": "str"}, }, - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ) ).result() # call '.result()' to poll until service return final result @@ -116,12 +116,12 @@ async def test_begin_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_delete(self, resource_group): + async def test_builders_begin_delete(self, resource_group): response = await ( await self.client.builders.begin_delete( resource_group_name=resource_group.name, builder_name="str", - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ) ).result() # call '.result()' to poll until service return final result diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_builds_by_builder_resource_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_builds_by_builder_resource_operations.py index b09222cbb50d..129e5d69c312 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_builds_by_builder_resource_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_builds_by_builder_resource_operations.py @@ -20,11 +20,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list(self, resource_group): + def test_builds_by_builder_resource_list(self, resource_group): response = self.client.builds_by_builder_resource.list( resource_group_name=resource_group.name, builder_name="str", - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_builds_by_builder_resource_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_builds_by_builder_resource_operations_async.py index 3bb9dc3a779f..bb0ee0bd8702 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_builds_by_builder_resource_operations_async.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_builds_by_builder_resource_operations_async.py @@ -21,11 +21,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list(self, resource_group): + async def test_builds_by_builder_resource_list(self, resource_group): response = self.client.builds_by_builder_resource.list( resource_group_name=resource_group.name, builder_name="str", - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_builds_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_builds_operations.py index 27fc8b6e19e6..9b5daedc4607 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_builds_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_builds_operations.py @@ -20,12 +20,12 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_builds_get(self, resource_group): response = self.client.builds.get( resource_group_name=resource_group.name, builder_name="str", build_name="str", - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -33,7 +33,7 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_create_or_update(self, resource_group): + def test_builds_begin_create_or_update(self, resource_group): response = self.client.builds.begin_create_or_update( resource_group_name=resource_group.name, builder_name="str", @@ -70,7 +70,7 @@ def test_begin_create_or_update(self, resource_group): "type": "str", "uploadEndpoint": "str", }, - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -78,12 +78,12 @@ def test_begin_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_delete(self, resource_group): + def test_builds_begin_delete(self, resource_group): response = self.client.builds.begin_delete( resource_group_name=resource_group.name, builder_name="str", build_name="str", - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_builds_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_builds_operations_async.py index 8926a7c50342..d1330fdc8e39 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_builds_operations_async.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_builds_operations_async.py @@ -21,12 +21,12 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_builds_get(self, resource_group): response = await self.client.builds.get( resource_group_name=resource_group.name, builder_name="str", build_name="str", - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -34,7 +34,7 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_create_or_update(self, resource_group): + async def test_builds_begin_create_or_update(self, resource_group): response = await ( await self.client.builds.begin_create_or_update( resource_group_name=resource_group.name, @@ -72,7 +72,7 @@ async def test_begin_create_or_update(self, resource_group): "type": "str", "uploadEndpoint": "str", }, - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ) ).result() # call '.result()' to poll until service return final result @@ -81,13 +81,13 @@ async def test_begin_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_delete(self, resource_group): + async def test_builds_begin_delete(self, resource_group): response = await ( await self.client.builds.begin_delete( resource_group_name=resource_group.name, builder_name="str", build_name="str", - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ) ).result() # call '.result()' to poll until service return final result diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_certificates_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_certificates_operations.py index ce65f9bef662..1a2b401cc36d 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_certificates_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_certificates_operations.py @@ -24,7 +24,7 @@ def test_certificates_list(self, resource_group): response = self.client.certificates.list( resource_group_name=resource_group.name, environment_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -37,7 +37,7 @@ def test_certificates_get(self, resource_group): resource_group_name=resource_group.name, environment_name="str", certificate_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -50,7 +50,7 @@ def test_certificates_create_or_update(self, resource_group): resource_group_name=resource_group.name, environment_name="str", certificate_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -63,7 +63,7 @@ def test_certificates_delete(self, resource_group): resource_group_name=resource_group.name, environment_name="str", certificate_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -77,7 +77,7 @@ def test_certificates_update(self, resource_group): environment_name="str", certificate_name="str", certificate_envelope={"tags": {"str": "str"}}, - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_certificates_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_certificates_operations_async.py index b5ffb708fa3c..4081fdc296e6 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_certificates_operations_async.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_certificates_operations_async.py @@ -25,7 +25,7 @@ async def test_certificates_list(self, resource_group): response = self.client.certificates.list( resource_group_name=resource_group.name, environment_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -38,7 +38,7 @@ async def test_certificates_get(self, resource_group): resource_group_name=resource_group.name, environment_name="str", certificate_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -51,7 +51,7 @@ async def test_certificates_create_or_update(self, resource_group): resource_group_name=resource_group.name, environment_name="str", certificate_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -64,7 +64,7 @@ async def test_certificates_delete(self, resource_group): resource_group_name=resource_group.name, environment_name="str", certificate_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -78,7 +78,7 @@ async def test_certificates_update(self, resource_group): environment_name="str", certificate_name="str", certificate_envelope={"tags": {"str": "str"}}, - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_certificates_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_certificates_operations.py index 00082d23d9bc..81bcd2e08260 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_certificates_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_certificates_operations.py @@ -24,7 +24,7 @@ def test_connected_environments_certificates_list(self, resource_group): response = self.client.connected_environments_certificates.list( resource_group_name=resource_group.name, connected_environment_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -37,7 +37,7 @@ def test_connected_environments_certificates_get(self, resource_group): resource_group_name=resource_group.name, connected_environment_name="str", certificate_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -45,40 +45,40 @@ def test_connected_environments_certificates_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_connected_environments_certificates_create_or_update(self, resource_group): - response = self.client.connected_environments_certificates.create_or_update( + def test_connected_environments_certificates_begin_create_or_update(self, resource_group): + response = self.client.connected_environments_certificates.begin_create_or_update( resource_group_name=resource_group.name, connected_environment_name="str", certificate_name="str", - api_version="2025-01-01", - ) + api_version="2025-02-02-preview", + ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_connected_environments_certificates_delete(self, resource_group): - response = self.client.connected_environments_certificates.delete( + def test_connected_environments_certificates_begin_delete(self, resource_group): + response = self.client.connected_environments_certificates.begin_delete( resource_group_name=resource_group.name, connected_environment_name="str", certificate_name="str", - api_version="2025-01-01", - ) + api_version="2025-02-02-preview", + ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_connected_environments_certificates_update(self, resource_group): - response = self.client.connected_environments_certificates.update( + def test_connected_environments_certificates_begin_update(self, resource_group): + response = self.client.connected_environments_certificates.begin_update( resource_group_name=resource_group.name, connected_environment_name="str", certificate_name="str", certificate_envelope={"tags": {"str": "str"}}, - api_version="2025-01-01", - ) + api_version="2025-02-02-preview", + ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_certificates_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_certificates_operations_async.py index 4bee350c4a7d..84ef57453b74 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_certificates_operations_async.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_certificates_operations_async.py @@ -25,7 +25,7 @@ async def test_connected_environments_certificates_list(self, resource_group): response = self.client.connected_environments_certificates.list( resource_group_name=resource_group.name, connected_environment_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -38,7 +38,7 @@ async def test_connected_environments_certificates_get(self, resource_group): resource_group_name=resource_group.name, connected_environment_name="str", certificate_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -46,40 +46,46 @@ async def test_connected_environments_certificates_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_connected_environments_certificates_create_or_update(self, resource_group): - response = await self.client.connected_environments_certificates.create_or_update( - resource_group_name=resource_group.name, - connected_environment_name="str", - certificate_name="str", - api_version="2025-01-01", - ) + async def test_connected_environments_certificates_begin_create_or_update(self, resource_group): + response = await ( + await self.client.connected_environments_certificates.begin_create_or_update( + resource_group_name=resource_group.name, + connected_environment_name="str", + certificate_name="str", + api_version="2025-02-02-preview", + ) + ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_connected_environments_certificates_delete(self, resource_group): - response = await self.client.connected_environments_certificates.delete( - resource_group_name=resource_group.name, - connected_environment_name="str", - certificate_name="str", - api_version="2025-01-01", - ) + async def test_connected_environments_certificates_begin_delete(self, resource_group): + response = await ( + await self.client.connected_environments_certificates.begin_delete( + resource_group_name=resource_group.name, + connected_environment_name="str", + certificate_name="str", + api_version="2025-02-02-preview", + ) + ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_connected_environments_certificates_update(self, resource_group): - response = await self.client.connected_environments_certificates.update( - resource_group_name=resource_group.name, - connected_environment_name="str", - certificate_name="str", - certificate_envelope={"tags": {"str": "str"}}, - api_version="2025-01-01", - ) + async def test_connected_environments_certificates_begin_update(self, resource_group): + response = await ( + await self.client.connected_environments_certificates.begin_update( + resource_group_name=resource_group.name, + connected_environment_name="str", + certificate_name="str", + certificate_envelope={"tags": {"str": "str"}}, + api_version="2025-02-02-preview", + ) + ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_dapr_components_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_dapr_components_operations.py index 81aa0ba3d21d..756951259318 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_dapr_components_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_dapr_components_operations.py @@ -24,7 +24,7 @@ def test_connected_environments_dapr_components_list(self, resource_group): response = self.client.connected_environments_dapr_components.list( resource_group_name=resource_group.name, connected_environment_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -37,7 +37,7 @@ def test_connected_environments_dapr_components_get(self, resource_group): resource_group_name=resource_group.name, connected_environment_name="str", component_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -45,21 +45,26 @@ def test_connected_environments_dapr_components_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_connected_environments_dapr_components_create_or_update(self, resource_group): - response = self.client.connected_environments_dapr_components.create_or_update( + def test_connected_environments_dapr_components_begin_create_or_update(self, resource_group): + response = self.client.connected_environments_dapr_components.begin_create_or_update( resource_group_name=resource_group.name, connected_environment_name="str", component_name="str", dapr_component_envelope={ "componentType": "str", + "deploymentErrors": "str", "id": "str", "ignoreErrors": False, "initTimeout": "str", "metadata": [{"name": "str", "secretRef": "str", "value": "str"}], "name": "str", + "provisioningState": "str", "scopes": ["str"], "secretStoreComponent": "str", "secrets": [{"identity": "str", "keyVaultUrl": "str", "name": "str", "value": "str"}], + "serviceComponentBind": [ + {"metadata": {"name": "str", "value": "str"}, "name": "str", "serviceId": "str"} + ], "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -71,21 +76,21 @@ def test_connected_environments_dapr_components_create_or_update(self, resource_ "type": "str", "version": "str", }, - api_version="2025-01-01", - ) + api_version="2025-02-02-preview", + ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_connected_environments_dapr_components_delete(self, resource_group): - response = self.client.connected_environments_dapr_components.delete( + def test_connected_environments_dapr_components_begin_delete(self, resource_group): + response = self.client.connected_environments_dapr_components.begin_delete( resource_group_name=resource_group.name, connected_environment_name="str", component_name="str", - api_version="2025-01-01", - ) + api_version="2025-02-02-preview", + ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... @@ -97,7 +102,7 @@ def test_connected_environments_dapr_components_list_secrets(self, resource_grou resource_group_name=resource_group.name, connected_environment_name="str", component_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_dapr_components_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_dapr_components_operations_async.py index a8358e671894..e766bb570e54 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_dapr_components_operations_async.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_dapr_components_operations_async.py @@ -25,7 +25,7 @@ async def test_connected_environments_dapr_components_list(self, resource_group) response = self.client.connected_environments_dapr_components.list( resource_group_name=resource_group.name, connected_environment_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -38,7 +38,7 @@ async def test_connected_environments_dapr_components_get(self, resource_group): resource_group_name=resource_group.name, connected_environment_name="str", component_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -46,47 +46,56 @@ async def test_connected_environments_dapr_components_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_connected_environments_dapr_components_create_or_update(self, resource_group): - response = await self.client.connected_environments_dapr_components.create_or_update( - resource_group_name=resource_group.name, - connected_environment_name="str", - component_name="str", - dapr_component_envelope={ - "componentType": "str", - "id": "str", - "ignoreErrors": False, - "initTimeout": "str", - "metadata": [{"name": "str", "secretRef": "str", "value": "str"}], - "name": "str", - "scopes": ["str"], - "secretStoreComponent": "str", - "secrets": [{"identity": "str", "keyVaultUrl": "str", "name": "str", "value": "str"}], - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", + async def test_connected_environments_dapr_components_begin_create_or_update(self, resource_group): + response = await ( + await self.client.connected_environments_dapr_components.begin_create_or_update( + resource_group_name=resource_group.name, + connected_environment_name="str", + component_name="str", + dapr_component_envelope={ + "componentType": "str", + "deploymentErrors": "str", + "id": "str", + "ignoreErrors": False, + "initTimeout": "str", + "metadata": [{"name": "str", "secretRef": "str", "value": "str"}], + "name": "str", + "provisioningState": "str", + "scopes": ["str"], + "secretStoreComponent": "str", + "secrets": [{"identity": "str", "keyVaultUrl": "str", "name": "str", "value": "str"}], + "serviceComponentBind": [ + {"metadata": {"name": "str", "value": "str"}, "name": "str", "serviceId": "str"} + ], + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + "version": "str", }, - "type": "str", - "version": "str", - }, - api_version="2025-01-01", - ) + api_version="2025-02-02-preview", + ) + ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_connected_environments_dapr_components_delete(self, resource_group): - response = await self.client.connected_environments_dapr_components.delete( - resource_group_name=resource_group.name, - connected_environment_name="str", - component_name="str", - api_version="2025-01-01", - ) + async def test_connected_environments_dapr_components_begin_delete(self, resource_group): + response = await ( + await self.client.connected_environments_dapr_components.begin_delete( + resource_group_name=resource_group.name, + connected_environment_name="str", + component_name="str", + api_version="2025-02-02-preview", + ) + ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... @@ -98,7 +107,7 @@ async def test_connected_environments_dapr_components_list_secrets(self, resourc resource_group_name=resource_group.name, connected_environment_name="str", component_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_operations.py index 5aa025ef8734..bd1021c358e0 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_operations.py @@ -22,7 +22,7 @@ def setup_method(self, method): @recorded_by_proxy def test_connected_environments_list_by_subscription(self, resource_group): response = self.client.connected_environments.list_by_subscription( - api_version="2025-01-01", + api_version="2025-02-02-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -33,7 +33,7 @@ def test_connected_environments_list_by_subscription(self, resource_group): def test_connected_environments_list_by_resource_group(self, resource_group): response = self.client.connected_environments.list_by_resource_group( resource_group_name=resource_group.name, - api_version="2025-01-01", + api_version="2025-02-02-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -45,7 +45,7 @@ def test_connected_environments_get(self, resource_group): response = self.client.connected_environments.get( resource_group_name=resource_group.name, connected_environment_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -88,7 +88,7 @@ def test_connected_environments_begin_create_or_update(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2025-01-01", + api_version="2025-02-02-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -100,7 +100,7 @@ def test_connected_environments_begin_delete(self, resource_group): response = self.client.connected_environments.begin_delete( resource_group_name=resource_group.name, connected_environment_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -112,7 +112,7 @@ def test_connected_environments_update(self, resource_group): response = self.client.connected_environments.update( resource_group_name=resource_group.name, connected_environment_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -125,7 +125,7 @@ def test_connected_environments_check_name_availability(self, resource_group): resource_group_name=resource_group.name, connected_environment_name="str", check_name_availability_request={"name": "str", "type": "str"}, - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_operations_async.py index c3e22be5bbbf..866e62258b9d 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_operations_async.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_operations_async.py @@ -23,7 +23,7 @@ def setup_method(self, method): @recorded_by_proxy_async async def test_connected_environments_list_by_subscription(self, resource_group): response = self.client.connected_environments.list_by_subscription( - api_version="2025-01-01", + api_version="2025-02-02-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -34,7 +34,7 @@ async def test_connected_environments_list_by_subscription(self, resource_group) async def test_connected_environments_list_by_resource_group(self, resource_group): response = self.client.connected_environments.list_by_resource_group( resource_group_name=resource_group.name, - api_version="2025-01-01", + api_version="2025-02-02-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -46,7 +46,7 @@ async def test_connected_environments_get(self, resource_group): response = await self.client.connected_environments.get( resource_group_name=resource_group.name, connected_environment_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -90,7 +90,7 @@ async def test_connected_environments_begin_create_or_update(self, resource_grou "tags": {"str": "str"}, "type": "str", }, - api_version="2025-01-01", + api_version="2025-02-02-preview", ) ).result() # call '.result()' to poll until service return final result @@ -104,7 +104,7 @@ async def test_connected_environments_begin_delete(self, resource_group): await self.client.connected_environments.begin_delete( resource_group_name=resource_group.name, connected_environment_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) ).result() # call '.result()' to poll until service return final result @@ -117,7 +117,7 @@ async def test_connected_environments_update(self, resource_group): response = await self.client.connected_environments.update( resource_group_name=resource_group.name, connected_environment_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -130,7 +130,7 @@ async def test_connected_environments_check_name_availability(self, resource_gro resource_group_name=resource_group.name, connected_environment_name="str", check_name_availability_request={"name": "str", "type": "str"}, - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_storages_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_storages_operations.py index c07dcd24210f..e5704f19a53a 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_storages_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_storages_operations.py @@ -24,7 +24,7 @@ def test_connected_environments_storages_list(self, resource_group): response = self.client.connected_environments_storages.list( resource_group_name=resource_group.name, connected_environment_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -37,7 +37,7 @@ def test_connected_environments_storages_get(self, resource_group): resource_group_name=resource_group.name, connected_environment_name="str", storage_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -45,8 +45,8 @@ def test_connected_environments_storages_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_connected_environments_storages_create_or_update(self, resource_group): - response = self.client.connected_environments_storages.create_or_update( + def test_connected_environments_storages_begin_create_or_update(self, resource_group): + response = self.client.connected_environments_storages.begin_create_or_update( resource_group_name=resource_group.name, connected_environment_name="str", storage_name="str", @@ -54,7 +54,23 @@ def test_connected_environments_storages_create_or_update(self, resource_group): "id": "str", "name": "str", "properties": { - "azureFile": {"accessMode": "str", "accountKey": "str", "accountName": "str", "shareName": "str"} + "azureFile": { + "accessMode": "str", + "accountKey": "str", + "accountKeyVaultProperties": {"identity": "str", "keyVaultUrl": "str"}, + "accountName": "str", + "shareName": "str", + }, + "deploymentErrors": "str", + "provisioningState": "str", + "smb": { + "accessMode": "str", + "domain": "str", + "host": "str", + "password": "str", + "shareName": "str", + "username": "str", + }, }, "systemData": { "createdAt": "2020-02-20 00:00:00", @@ -66,21 +82,21 @@ def test_connected_environments_storages_create_or_update(self, resource_group): }, "type": "str", }, - api_version="2025-01-01", - ) + api_version="2025-02-02-preview", + ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_connected_environments_storages_delete(self, resource_group): - response = self.client.connected_environments_storages.delete( + def test_connected_environments_storages_begin_delete(self, resource_group): + response = self.client.connected_environments_storages.begin_delete( resource_group_name=resource_group.name, connected_environment_name="str", storage_name="str", - api_version="2025-01-01", - ) + api_version="2025-02-02-preview", + ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_storages_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_storages_operations_async.py index 6f7bc4287813..78f646b8b5ca 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_storages_operations_async.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_storages_operations_async.py @@ -25,7 +25,7 @@ async def test_connected_environments_storages_list(self, resource_group): response = await self.client.connected_environments_storages.list( resource_group_name=resource_group.name, connected_environment_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -38,7 +38,7 @@ async def test_connected_environments_storages_get(self, resource_group): resource_group_name=resource_group.name, connected_environment_name="str", storage_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -46,42 +46,62 @@ async def test_connected_environments_storages_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_connected_environments_storages_create_or_update(self, resource_group): - response = await self.client.connected_environments_storages.create_or_update( - resource_group_name=resource_group.name, - connected_environment_name="str", - storage_name="str", - storage_envelope={ - "id": "str", - "name": "str", - "properties": { - "azureFile": {"accessMode": "str", "accountKey": "str", "accountName": "str", "shareName": "str"} + async def test_connected_environments_storages_begin_create_or_update(self, resource_group): + response = await ( + await self.client.connected_environments_storages.begin_create_or_update( + resource_group_name=resource_group.name, + connected_environment_name="str", + storage_name="str", + storage_envelope={ + "id": "str", + "name": "str", + "properties": { + "azureFile": { + "accessMode": "str", + "accountKey": "str", + "accountKeyVaultProperties": {"identity": "str", "keyVaultUrl": "str"}, + "accountName": "str", + "shareName": "str", + }, + "deploymentErrors": "str", + "provisioningState": "str", + "smb": { + "accessMode": "str", + "domain": "str", + "host": "str", + "password": "str", + "shareName": "str", + "username": "str", + }, + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", }, - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", - }, - "type": "str", - }, - api_version="2025-01-01", - ) + api_version="2025-02-02-preview", + ) + ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_connected_environments_storages_delete(self, resource_group): - response = await self.client.connected_environments_storages.delete( - resource_group_name=resource_group.name, - connected_environment_name="str", - storage_name="str", - api_version="2025-01-01", - ) + async def test_connected_environments_storages_begin_delete(self, resource_group): + response = await ( + await self.client.connected_environments_storages.begin_delete( + resource_group_name=resource_group.name, + connected_environment_name="str", + storage_name="str", + api_version="2025-02-02-preview", + ) + ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_auth_configs_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_auth_configs_operations.py index 8a4f17359cd6..7c49ea9ef6d3 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_auth_configs_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_auth_configs_operations.py @@ -24,7 +24,7 @@ def test_container_apps_auth_configs_list_by_container_app(self, resource_group) response = self.client.container_apps_auth_configs.list_by_container_app( resource_group_name=resource_group.name, container_app_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -37,7 +37,7 @@ def test_container_apps_auth_configs_get(self, resource_group): resource_group_name=resource_group.name, container_app_name="str", auth_config_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -144,7 +144,12 @@ def test_container_apps_auth_configs_create_or_update(self, resource_group): "preserveUrlFragmentsForLogins": bool, "routes": {"logoutEndpoint": "str"}, "tokenStore": { - "azureBlobStorage": {"sasUrlSettingName": "str"}, + "azureBlobStorage": { + "blobContainerUri": "str", + "clientId": "str", + "managedIdentityResourceId": "str", + "sasUrlSettingName": "str", + }, "enabled": bool, "tokenRefreshExtensionHours": 0.0, }, @@ -161,7 +166,7 @@ def test_container_apps_auth_configs_create_or_update(self, resource_group): }, "type": "str", }, - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -174,7 +179,7 @@ def test_container_apps_auth_configs_delete(self, resource_group): resource_group_name=resource_group.name, container_app_name="str", auth_config_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_auth_configs_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_auth_configs_operations_async.py index d0f6ded65abc..b209ccacb5ed 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_auth_configs_operations_async.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_auth_configs_operations_async.py @@ -25,7 +25,7 @@ async def test_container_apps_auth_configs_list_by_container_app(self, resource_ response = self.client.container_apps_auth_configs.list_by_container_app( resource_group_name=resource_group.name, container_app_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -38,7 +38,7 @@ async def test_container_apps_auth_configs_get(self, resource_group): resource_group_name=resource_group.name, container_app_name="str", auth_config_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -145,7 +145,12 @@ async def test_container_apps_auth_configs_create_or_update(self, resource_group "preserveUrlFragmentsForLogins": bool, "routes": {"logoutEndpoint": "str"}, "tokenStore": { - "azureBlobStorage": {"sasUrlSettingName": "str"}, + "azureBlobStorage": { + "blobContainerUri": "str", + "clientId": "str", + "managedIdentityResourceId": "str", + "sasUrlSettingName": "str", + }, "enabled": bool, "tokenRefreshExtensionHours": 0.0, }, @@ -162,7 +167,7 @@ async def test_container_apps_auth_configs_create_or_update(self, resource_group }, "type": "str", }, - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -175,7 +180,7 @@ async def test_container_apps_auth_configs_delete(self, resource_group): resource_group_name=resource_group.name, container_app_name="str", auth_config_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_builds_by_container_app_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_builds_by_container_app_operations.py index de15466e9fb8..8754339fabb3 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_builds_by_container_app_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_builds_by_container_app_operations.py @@ -20,11 +20,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list(self, resource_group): + def test_container_apps_builds_by_container_app_list(self, resource_group): response = self.client.container_apps_builds_by_container_app.list( resource_group_name=resource_group.name, container_app_name="str", - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_builds_by_container_app_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_builds_by_container_app_operations_async.py index 88f9aa60204e..dfec2db327be 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_builds_by_container_app_operations_async.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_builds_by_container_app_operations_async.py @@ -21,11 +21,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list(self, resource_group): + async def test_container_apps_builds_by_container_app_list(self, resource_group): response = self.client.container_apps_builds_by_container_app.list( resource_group_name=resource_group.name, container_app_name="str", - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_builds_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_builds_operations.py index b401d0208703..d660bc7e2e6c 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_builds_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_builds_operations.py @@ -20,12 +20,12 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_container_apps_builds_get(self, resource_group): response = self.client.container_apps_builds.get( resource_group_name=resource_group.name, container_app_name="str", build_name="str", - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -33,12 +33,12 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_delete(self, resource_group): + def test_container_apps_builds_begin_delete(self, resource_group): response = self.client.container_apps_builds.begin_delete( resource_group_name=resource_group.name, container_app_name="str", build_name="str", - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_builds_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_builds_operations_async.py index d3686d69e48e..18f91650fe74 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_builds_operations_async.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_builds_operations_async.py @@ -21,12 +21,12 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_container_apps_builds_get(self, resource_group): response = await self.client.container_apps_builds.get( resource_group_name=resource_group.name, container_app_name="str", build_name="str", - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -34,13 +34,13 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_delete(self, resource_group): + async def test_container_apps_builds_begin_delete(self, resource_group): response = await ( await self.client.container_apps_builds.begin_delete( resource_group_name=resource_group.name, container_app_name="str", build_name="str", - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ) ).result() # call '.result()' to poll until service return final result diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_diagnostics_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_diagnostics_operations.py index 886a834da688..6e80aa8ee556 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_diagnostics_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_diagnostics_operations.py @@ -24,7 +24,7 @@ def test_container_apps_diagnostics_list_detectors(self, resource_group): response = self.client.container_apps_diagnostics.list_detectors( resource_group_name=resource_group.name, container_app_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -37,7 +37,7 @@ def test_container_apps_diagnostics_get_detector(self, resource_group): resource_group_name=resource_group.name, container_app_name="str", detector_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -49,7 +49,7 @@ def test_container_apps_diagnostics_list_revisions(self, resource_group): response = self.client.container_apps_diagnostics.list_revisions( resource_group_name=resource_group.name, container_app_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -62,7 +62,7 @@ def test_container_apps_diagnostics_get_revision(self, resource_group): resource_group_name=resource_group.name, container_app_name="str", revision_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -74,7 +74,7 @@ def test_container_apps_diagnostics_get_root(self, resource_group): response = self.client.container_apps_diagnostics.get_root( resource_group_name=resource_group.name, container_app_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_diagnostics_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_diagnostics_operations_async.py index 53446dc8a3b4..29715fc18134 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_diagnostics_operations_async.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_diagnostics_operations_async.py @@ -25,7 +25,7 @@ async def test_container_apps_diagnostics_list_detectors(self, resource_group): response = self.client.container_apps_diagnostics.list_detectors( resource_group_name=resource_group.name, container_app_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -38,7 +38,7 @@ async def test_container_apps_diagnostics_get_detector(self, resource_group): resource_group_name=resource_group.name, container_app_name="str", detector_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -50,7 +50,7 @@ async def test_container_apps_diagnostics_list_revisions(self, resource_group): response = self.client.container_apps_diagnostics.list_revisions( resource_group_name=resource_group.name, container_app_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -63,7 +63,7 @@ async def test_container_apps_diagnostics_get_revision(self, resource_group): resource_group_name=resource_group.name, container_app_name="str", revision_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -75,7 +75,7 @@ async def test_container_apps_diagnostics_get_root(self, resource_group): response = await self.client.container_apps_diagnostics.get_root( resource_group_name=resource_group.name, container_app_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_label_history_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_label_history_operations.py new file mode 100644 index 000000000000..6f4e511ec807 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_label_history_operations.py @@ -0,0 +1,57 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIContainerAppsLabelHistoryOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_container_apps_label_history_list_label_history(self, resource_group): + response = self.client.container_apps_label_history.list_label_history( + resource_group_name=resource_group.name, + container_app_name="str", + api_version="2025-02-02-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_container_apps_label_history_get_label_history(self, resource_group): + response = self.client.container_apps_label_history.get_label_history( + resource_group_name=resource_group.name, + container_app_name="str", + label_name="str", + api_version="2025-02-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_container_apps_label_history_delete_label_history(self, resource_group): + response = self.client.container_apps_label_history.delete_label_history( + resource_group_name=resource_group.name, + container_app_name="str", + label_name="str", + api_version="2025-02-02-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_label_history_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_label_history_operations_async.py new file mode 100644 index 000000000000..94291d701c13 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_label_history_operations_async.py @@ -0,0 +1,58 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIContainerAppsLabelHistoryOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_container_apps_label_history_list_label_history(self, resource_group): + response = self.client.container_apps_label_history.list_label_history( + resource_group_name=resource_group.name, + container_app_name="str", + api_version="2025-02-02-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_container_apps_label_history_get_label_history(self, resource_group): + response = await self.client.container_apps_label_history.get_label_history( + resource_group_name=resource_group.name, + container_app_name="str", + label_name="str", + api_version="2025-02-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_container_apps_label_history_delete_label_history(self, resource_group): + response = await self.client.container_apps_label_history.delete_label_history( + resource_group_name=resource_group.name, + container_app_name="str", + label_name="str", + api_version="2025-02-02-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_operations.py index 9a5d7f47e1f9..18d7f0fc5616 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_operations.py @@ -22,7 +22,7 @@ def setup_method(self, method): @recorded_by_proxy def test_container_apps_list_by_subscription(self, resource_group): response = self.client.container_apps.list_by_subscription( - api_version="2025-01-01", + api_version="2025-02-02-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -33,7 +33,7 @@ def test_container_apps_list_by_subscription(self, resource_group): def test_container_apps_list_by_resource_group(self, resource_group): response = self.client.container_apps.list_by_resource_group( resource_group_name=resource_group.name, - api_version="2025-01-01", + api_version="2025-02-02-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -45,7 +45,7 @@ def test_container_apps_get(self, resource_group): response = self.client.container_apps.get( resource_group_name=resource_group.name, container_app_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -62,6 +62,13 @@ def test_container_apps_begin_create_or_update(self, resource_group): "configuration": { "activeRevisionsMode": "Single", "dapr": { + "appHealth": { + "enabled": bool, + "path": "str", + "probeIntervalSeconds": 0, + "probeTimeoutMilliseconds": 0, + "threshold": 0, + }, "appId": "str", "appPort": 0, "appProtocol": "http", @@ -70,6 +77,7 @@ def test_container_apps_begin_create_or_update(self, resource_group): "httpMaxRequestSize": 0, "httpReadBufferSize": 0, "logLevel": "str", + "maxConcurrency": 0, }, "identitySettings": [{"identity": "str", "lifecycle": "str"}], "ingress": { @@ -93,16 +101,29 @@ def test_container_apps_begin_create_or_update(self, resource_group): ], "stickySessions": {"affinity": "str"}, "targetPort": 0, + "targetPortHttpScheme": "str", "traffic": [{"label": "str", "latestRevision": False, "revisionName": "str", "weight": 0}], "transport": "auto", }, "maxInactiveRevisions": 0, "registries": [{"identity": "str", "passwordSecretRef": "str", "server": "str", "username": "str"}], - "runtime": {"java": {"enableMetrics": bool}}, + "revisionTransitionThreshold": 0, + "runtime": { + "dotnet": {"autoConfigureDataProtection": bool}, + "java": { + "enableMetrics": bool, + "javaAgent": { + "enabled": bool, + "logging": {"loggerSettings": [{"level": "str", "logger": "str"}]}, + }, + }, + }, "secrets": [{"identity": "str", "keyVaultUrl": "str", "name": "str", "value": "str"}], "service": {"type": "str"}, + "targetLabel": "str", }, "customDomainVerificationId": "str", + "deploymentErrors": "str", "environmentId": "str", "eventStreamEndpoint": "str", "extendedLocation": {"name": "str", "type": "str"}, @@ -113,6 +134,7 @@ def test_container_apps_begin_create_or_update(self, resource_group): "tenantId": "str", "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, }, + "kind": "str", "latestReadyRevisionName": "str", "latestRevisionFqdn": "str", "latestRevisionName": "str", @@ -120,6 +142,7 @@ def test_container_apps_begin_create_or_update(self, resource_group): "managedEnvironmentId": "str", "name": "str", "outboundIpAddresses": ["str"], + "patchingConfiguration": {"patchingMode": "str"}, "provisioningState": "str", "runningStatus": "str", "systemData": { @@ -138,6 +161,7 @@ def test_container_apps_begin_create_or_update(self, resource_group): "command": ["str"], "env": [{"name": "str", "secretRef": "str", "value": "str"}], "image": "str", + "imageType": "str", "name": "str", "probes": [ { @@ -158,7 +182,7 @@ def test_container_apps_begin_create_or_update(self, resource_group): "type": "str", } ], - "resources": {"cpu": 0.0, "ephemeralStorage": "str", "memory": "str"}, + "resources": {"cpu": 0.0, "ephemeralStorage": "str", "gpu": 0.0, "memory": "str"}, "volumeMounts": [{"mountPath": "str", "subPath": "str", "volumeName": "str"}], } ], @@ -168,8 +192,9 @@ def test_container_apps_begin_create_or_update(self, resource_group): "command": ["str"], "env": [{"name": "str", "secretRef": "str", "value": "str"}], "image": "str", + "imageType": "str", "name": "str", - "resources": {"cpu": 0.0, "ephemeralStorage": "str", "memory": "str"}, + "resources": {"cpu": 0.0, "ephemeralStorage": "str", "gpu": 0.0, "memory": "str"}, "volumeMounts": [{"mountPath": "str", "subPath": "str", "volumeName": "str"}], } ], @@ -208,7 +233,9 @@ def test_container_apps_begin_create_or_update(self, resource_group): } ], }, - "serviceBinds": [{"name": "str", "serviceId": "str"}], + "serviceBinds": [ + {"clientType": "str", "customizedKeys": {"str": "str"}, "name": "str", "serviceId": "str"} + ], "terminationGracePeriodSeconds": 0, "volumes": [ { @@ -223,7 +250,7 @@ def test_container_apps_begin_create_or_update(self, resource_group): "type": "str", "workloadProfileName": "str", }, - api_version="2025-01-01", + api_version="2025-02-02-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -235,7 +262,7 @@ def test_container_apps_begin_delete(self, resource_group): response = self.client.container_apps.begin_delete( resource_group_name=resource_group.name, container_app_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -252,6 +279,13 @@ def test_container_apps_begin_update(self, resource_group): "configuration": { "activeRevisionsMode": "Single", "dapr": { + "appHealth": { + "enabled": bool, + "path": "str", + "probeIntervalSeconds": 0, + "probeTimeoutMilliseconds": 0, + "threshold": 0, + }, "appId": "str", "appPort": 0, "appProtocol": "http", @@ -260,6 +294,7 @@ def test_container_apps_begin_update(self, resource_group): "httpMaxRequestSize": 0, "httpReadBufferSize": 0, "logLevel": "str", + "maxConcurrency": 0, }, "identitySettings": [{"identity": "str", "lifecycle": "str"}], "ingress": { @@ -283,16 +318,29 @@ def test_container_apps_begin_update(self, resource_group): ], "stickySessions": {"affinity": "str"}, "targetPort": 0, + "targetPortHttpScheme": "str", "traffic": [{"label": "str", "latestRevision": False, "revisionName": "str", "weight": 0}], "transport": "auto", }, "maxInactiveRevisions": 0, "registries": [{"identity": "str", "passwordSecretRef": "str", "server": "str", "username": "str"}], - "runtime": {"java": {"enableMetrics": bool}}, + "revisionTransitionThreshold": 0, + "runtime": { + "dotnet": {"autoConfigureDataProtection": bool}, + "java": { + "enableMetrics": bool, + "javaAgent": { + "enabled": bool, + "logging": {"loggerSettings": [{"level": "str", "logger": "str"}]}, + }, + }, + }, "secrets": [{"identity": "str", "keyVaultUrl": "str", "name": "str", "value": "str"}], "service": {"type": "str"}, + "targetLabel": "str", }, "customDomainVerificationId": "str", + "deploymentErrors": "str", "environmentId": "str", "eventStreamEndpoint": "str", "extendedLocation": {"name": "str", "type": "str"}, @@ -303,6 +351,7 @@ def test_container_apps_begin_update(self, resource_group): "tenantId": "str", "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, }, + "kind": "str", "latestReadyRevisionName": "str", "latestRevisionFqdn": "str", "latestRevisionName": "str", @@ -310,6 +359,7 @@ def test_container_apps_begin_update(self, resource_group): "managedEnvironmentId": "str", "name": "str", "outboundIpAddresses": ["str"], + "patchingConfiguration": {"patchingMode": "str"}, "provisioningState": "str", "runningStatus": "str", "systemData": { @@ -328,6 +378,7 @@ def test_container_apps_begin_update(self, resource_group): "command": ["str"], "env": [{"name": "str", "secretRef": "str", "value": "str"}], "image": "str", + "imageType": "str", "name": "str", "probes": [ { @@ -348,7 +399,7 @@ def test_container_apps_begin_update(self, resource_group): "type": "str", } ], - "resources": {"cpu": 0.0, "ephemeralStorage": "str", "memory": "str"}, + "resources": {"cpu": 0.0, "ephemeralStorage": "str", "gpu": 0.0, "memory": "str"}, "volumeMounts": [{"mountPath": "str", "subPath": "str", "volumeName": "str"}], } ], @@ -358,8 +409,9 @@ def test_container_apps_begin_update(self, resource_group): "command": ["str"], "env": [{"name": "str", "secretRef": "str", "value": "str"}], "image": "str", + "imageType": "str", "name": "str", - "resources": {"cpu": 0.0, "ephemeralStorage": "str", "memory": "str"}, + "resources": {"cpu": 0.0, "ephemeralStorage": "str", "gpu": 0.0, "memory": "str"}, "volumeMounts": [{"mountPath": "str", "subPath": "str", "volumeName": "str"}], } ], @@ -398,7 +450,9 @@ def test_container_apps_begin_update(self, resource_group): } ], }, - "serviceBinds": [{"name": "str", "serviceId": "str"}], + "serviceBinds": [ + {"clientType": "str", "customizedKeys": {"str": "str"}, "name": "str", "serviceId": "str"} + ], "terminationGracePeriodSeconds": 0, "volumes": [ { @@ -413,7 +467,7 @@ def test_container_apps_begin_update(self, resource_group): "type": "str", "workloadProfileName": "str", }, - api_version="2025-01-01", + api_version="2025-02-02-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -425,7 +479,7 @@ def test_container_apps_list_custom_host_name_analysis(self, resource_group): response = self.client.container_apps.list_custom_host_name_analysis( resource_group_name=resource_group.name, container_app_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -437,7 +491,7 @@ def test_container_apps_list_secrets(self, resource_group): response = self.client.container_apps.list_secrets( resource_group_name=resource_group.name, container_app_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -449,7 +503,7 @@ def test_container_apps_get_auth_token(self, resource_group): response = self.client.container_apps.get_auth_token( resource_group_name=resource_group.name, container_app_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -461,7 +515,7 @@ def test_container_apps_begin_start(self, resource_group): response = self.client.container_apps.begin_start( resource_group_name=resource_group.name, container_app_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -473,7 +527,7 @@ def test_container_apps_begin_stop(self, resource_group): response = self.client.container_apps.begin_stop( resource_group_name=resource_group.name, container_app_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_operations_async.py index 34830452c85e..1039411fb3bc 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_operations_async.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_operations_async.py @@ -23,7 +23,7 @@ def setup_method(self, method): @recorded_by_proxy_async async def test_container_apps_list_by_subscription(self, resource_group): response = self.client.container_apps.list_by_subscription( - api_version="2025-01-01", + api_version="2025-02-02-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -34,7 +34,7 @@ async def test_container_apps_list_by_subscription(self, resource_group): async def test_container_apps_list_by_resource_group(self, resource_group): response = self.client.container_apps.list_by_resource_group( resource_group_name=resource_group.name, - api_version="2025-01-01", + api_version="2025-02-02-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -46,7 +46,7 @@ async def test_container_apps_get(self, resource_group): response = await self.client.container_apps.get( resource_group_name=resource_group.name, container_app_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -64,6 +64,13 @@ async def test_container_apps_begin_create_or_update(self, resource_group): "configuration": { "activeRevisionsMode": "Single", "dapr": { + "appHealth": { + "enabled": bool, + "path": "str", + "probeIntervalSeconds": 0, + "probeTimeoutMilliseconds": 0, + "threshold": 0, + }, "appId": "str", "appPort": 0, "appProtocol": "http", @@ -72,6 +79,7 @@ async def test_container_apps_begin_create_or_update(self, resource_group): "httpMaxRequestSize": 0, "httpReadBufferSize": 0, "logLevel": "str", + "maxConcurrency": 0, }, "identitySettings": [{"identity": "str", "lifecycle": "str"}], "ingress": { @@ -95,6 +103,7 @@ async def test_container_apps_begin_create_or_update(self, resource_group): ], "stickySessions": {"affinity": "str"}, "targetPort": 0, + "targetPortHttpScheme": "str", "traffic": [{"label": "str", "latestRevision": False, "revisionName": "str", "weight": 0}], "transport": "auto", }, @@ -102,11 +111,23 @@ async def test_container_apps_begin_create_or_update(self, resource_group): "registries": [ {"identity": "str", "passwordSecretRef": "str", "server": "str", "username": "str"} ], - "runtime": {"java": {"enableMetrics": bool}}, + "revisionTransitionThreshold": 0, + "runtime": { + "dotnet": {"autoConfigureDataProtection": bool}, + "java": { + "enableMetrics": bool, + "javaAgent": { + "enabled": bool, + "logging": {"loggerSettings": [{"level": "str", "logger": "str"}]}, + }, + }, + }, "secrets": [{"identity": "str", "keyVaultUrl": "str", "name": "str", "value": "str"}], "service": {"type": "str"}, + "targetLabel": "str", }, "customDomainVerificationId": "str", + "deploymentErrors": "str", "environmentId": "str", "eventStreamEndpoint": "str", "extendedLocation": {"name": "str", "type": "str"}, @@ -117,6 +138,7 @@ async def test_container_apps_begin_create_or_update(self, resource_group): "tenantId": "str", "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, }, + "kind": "str", "latestReadyRevisionName": "str", "latestRevisionFqdn": "str", "latestRevisionName": "str", @@ -124,6 +146,7 @@ async def test_container_apps_begin_create_or_update(self, resource_group): "managedEnvironmentId": "str", "name": "str", "outboundIpAddresses": ["str"], + "patchingConfiguration": {"patchingMode": "str"}, "provisioningState": "str", "runningStatus": "str", "systemData": { @@ -142,6 +165,7 @@ async def test_container_apps_begin_create_or_update(self, resource_group): "command": ["str"], "env": [{"name": "str", "secretRef": "str", "value": "str"}], "image": "str", + "imageType": "str", "name": "str", "probes": [ { @@ -162,7 +186,7 @@ async def test_container_apps_begin_create_or_update(self, resource_group): "type": "str", } ], - "resources": {"cpu": 0.0, "ephemeralStorage": "str", "memory": "str"}, + "resources": {"cpu": 0.0, "ephemeralStorage": "str", "gpu": 0.0, "memory": "str"}, "volumeMounts": [{"mountPath": "str", "subPath": "str", "volumeName": "str"}], } ], @@ -172,8 +196,9 @@ async def test_container_apps_begin_create_or_update(self, resource_group): "command": ["str"], "env": [{"name": "str", "secretRef": "str", "value": "str"}], "image": "str", + "imageType": "str", "name": "str", - "resources": {"cpu": 0.0, "ephemeralStorage": "str", "memory": "str"}, + "resources": {"cpu": 0.0, "ephemeralStorage": "str", "gpu": 0.0, "memory": "str"}, "volumeMounts": [{"mountPath": "str", "subPath": "str", "volumeName": "str"}], } ], @@ -212,7 +237,9 @@ async def test_container_apps_begin_create_or_update(self, resource_group): } ], }, - "serviceBinds": [{"name": "str", "serviceId": "str"}], + "serviceBinds": [ + {"clientType": "str", "customizedKeys": {"str": "str"}, "name": "str", "serviceId": "str"} + ], "terminationGracePeriodSeconds": 0, "volumes": [ { @@ -227,7 +254,7 @@ async def test_container_apps_begin_create_or_update(self, resource_group): "type": "str", "workloadProfileName": "str", }, - api_version="2025-01-01", + api_version="2025-02-02-preview", ) ).result() # call '.result()' to poll until service return final result @@ -241,7 +268,7 @@ async def test_container_apps_begin_delete(self, resource_group): await self.client.container_apps.begin_delete( resource_group_name=resource_group.name, container_app_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) ).result() # call '.result()' to poll until service return final result @@ -260,6 +287,13 @@ async def test_container_apps_begin_update(self, resource_group): "configuration": { "activeRevisionsMode": "Single", "dapr": { + "appHealth": { + "enabled": bool, + "path": "str", + "probeIntervalSeconds": 0, + "probeTimeoutMilliseconds": 0, + "threshold": 0, + }, "appId": "str", "appPort": 0, "appProtocol": "http", @@ -268,6 +302,7 @@ async def test_container_apps_begin_update(self, resource_group): "httpMaxRequestSize": 0, "httpReadBufferSize": 0, "logLevel": "str", + "maxConcurrency": 0, }, "identitySettings": [{"identity": "str", "lifecycle": "str"}], "ingress": { @@ -291,6 +326,7 @@ async def test_container_apps_begin_update(self, resource_group): ], "stickySessions": {"affinity": "str"}, "targetPort": 0, + "targetPortHttpScheme": "str", "traffic": [{"label": "str", "latestRevision": False, "revisionName": "str", "weight": 0}], "transport": "auto", }, @@ -298,11 +334,23 @@ async def test_container_apps_begin_update(self, resource_group): "registries": [ {"identity": "str", "passwordSecretRef": "str", "server": "str", "username": "str"} ], - "runtime": {"java": {"enableMetrics": bool}}, + "revisionTransitionThreshold": 0, + "runtime": { + "dotnet": {"autoConfigureDataProtection": bool}, + "java": { + "enableMetrics": bool, + "javaAgent": { + "enabled": bool, + "logging": {"loggerSettings": [{"level": "str", "logger": "str"}]}, + }, + }, + }, "secrets": [{"identity": "str", "keyVaultUrl": "str", "name": "str", "value": "str"}], "service": {"type": "str"}, + "targetLabel": "str", }, "customDomainVerificationId": "str", + "deploymentErrors": "str", "environmentId": "str", "eventStreamEndpoint": "str", "extendedLocation": {"name": "str", "type": "str"}, @@ -313,6 +361,7 @@ async def test_container_apps_begin_update(self, resource_group): "tenantId": "str", "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, }, + "kind": "str", "latestReadyRevisionName": "str", "latestRevisionFqdn": "str", "latestRevisionName": "str", @@ -320,6 +369,7 @@ async def test_container_apps_begin_update(self, resource_group): "managedEnvironmentId": "str", "name": "str", "outboundIpAddresses": ["str"], + "patchingConfiguration": {"patchingMode": "str"}, "provisioningState": "str", "runningStatus": "str", "systemData": { @@ -338,6 +388,7 @@ async def test_container_apps_begin_update(self, resource_group): "command": ["str"], "env": [{"name": "str", "secretRef": "str", "value": "str"}], "image": "str", + "imageType": "str", "name": "str", "probes": [ { @@ -358,7 +409,7 @@ async def test_container_apps_begin_update(self, resource_group): "type": "str", } ], - "resources": {"cpu": 0.0, "ephemeralStorage": "str", "memory": "str"}, + "resources": {"cpu": 0.0, "ephemeralStorage": "str", "gpu": 0.0, "memory": "str"}, "volumeMounts": [{"mountPath": "str", "subPath": "str", "volumeName": "str"}], } ], @@ -368,8 +419,9 @@ async def test_container_apps_begin_update(self, resource_group): "command": ["str"], "env": [{"name": "str", "secretRef": "str", "value": "str"}], "image": "str", + "imageType": "str", "name": "str", - "resources": {"cpu": 0.0, "ephemeralStorage": "str", "memory": "str"}, + "resources": {"cpu": 0.0, "ephemeralStorage": "str", "gpu": 0.0, "memory": "str"}, "volumeMounts": [{"mountPath": "str", "subPath": "str", "volumeName": "str"}], } ], @@ -408,7 +460,9 @@ async def test_container_apps_begin_update(self, resource_group): } ], }, - "serviceBinds": [{"name": "str", "serviceId": "str"}], + "serviceBinds": [ + {"clientType": "str", "customizedKeys": {"str": "str"}, "name": "str", "serviceId": "str"} + ], "terminationGracePeriodSeconds": 0, "volumes": [ { @@ -423,7 +477,7 @@ async def test_container_apps_begin_update(self, resource_group): "type": "str", "workloadProfileName": "str", }, - api_version="2025-01-01", + api_version="2025-02-02-preview", ) ).result() # call '.result()' to poll until service return final result @@ -436,7 +490,7 @@ async def test_container_apps_list_custom_host_name_analysis(self, resource_grou response = await self.client.container_apps.list_custom_host_name_analysis( resource_group_name=resource_group.name, container_app_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -448,7 +502,7 @@ async def test_container_apps_list_secrets(self, resource_group): response = await self.client.container_apps.list_secrets( resource_group_name=resource_group.name, container_app_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -460,7 +514,7 @@ async def test_container_apps_get_auth_token(self, resource_group): response = await self.client.container_apps.get_auth_token( resource_group_name=resource_group.name, container_app_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -473,7 +527,7 @@ async def test_container_apps_begin_start(self, resource_group): await self.client.container_apps.begin_start( resource_group_name=resource_group.name, container_app_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) ).result() # call '.result()' to poll until service return final result @@ -487,7 +541,7 @@ async def test_container_apps_begin_stop(self, resource_group): await self.client.container_apps.begin_stop( resource_group_name=resource_group.name, container_app_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) ).result() # call '.result()' to poll until service return final result diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_patches_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_patches_operations.py index 066218350cda..170f011c59ea 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_patches_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_patches_operations.py @@ -20,11 +20,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_by_container_app(self, resource_group): + def test_container_apps_patches_list_by_container_app(self, resource_group): response = self.client.container_apps_patches.list_by_container_app( resource_group_name=resource_group.name, container_app_name="str", - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -32,12 +32,12 @@ def test_list_by_container_app(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_container_apps_patches_get(self, resource_group): response = self.client.container_apps_patches.get( resource_group_name=resource_group.name, container_app_name="str", patch_name="str", - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -45,12 +45,12 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_delete(self, resource_group): + def test_container_apps_patches_begin_delete(self, resource_group): response = self.client.container_apps_patches.begin_delete( resource_group_name=resource_group.name, container_app_name="str", patch_name="str", - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -58,13 +58,13 @@ def test_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_skip_configure(self, resource_group): + def test_container_apps_patches_begin_skip_configure(self, resource_group): response = self.client.container_apps_patches.begin_skip_configure( resource_group_name=resource_group.name, container_app_name="str", patch_name="str", patch_skip_config={"skip": bool}, - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -72,12 +72,12 @@ def test_begin_skip_configure(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_apply(self, resource_group): + def test_container_apps_patches_begin_apply(self, resource_group): response = self.client.container_apps_patches.begin_apply( resource_group_name=resource_group.name, container_app_name="str", patch_name="str", - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_patches_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_patches_operations_async.py index ceffcba02976..f978d2fc228a 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_patches_operations_async.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_patches_operations_async.py @@ -21,11 +21,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_by_container_app(self, resource_group): + async def test_container_apps_patches_list_by_container_app(self, resource_group): response = self.client.container_apps_patches.list_by_container_app( resource_group_name=resource_group.name, container_app_name="str", - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -33,12 +33,12 @@ async def test_list_by_container_app(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_container_apps_patches_get(self, resource_group): response = await self.client.container_apps_patches.get( resource_group_name=resource_group.name, container_app_name="str", patch_name="str", - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -46,13 +46,13 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_delete(self, resource_group): + async def test_container_apps_patches_begin_delete(self, resource_group): response = await ( await self.client.container_apps_patches.begin_delete( resource_group_name=resource_group.name, container_app_name="str", patch_name="str", - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ) ).result() # call '.result()' to poll until service return final result @@ -61,14 +61,14 @@ async def test_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_skip_configure(self, resource_group): + async def test_container_apps_patches_begin_skip_configure(self, resource_group): response = await ( await self.client.container_apps_patches.begin_skip_configure( resource_group_name=resource_group.name, container_app_name="str", patch_name="str", patch_skip_config={"skip": bool}, - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ) ).result() # call '.result()' to poll until service return final result @@ -77,13 +77,13 @@ async def test_begin_skip_configure(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_apply(self, resource_group): + async def test_container_apps_patches_begin_apply(self, resource_group): response = await ( await self.client.container_apps_patches.begin_apply( resource_group_name=resource_group.name, container_app_name="str", patch_name="str", - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ) ).result() # call '.result()' to poll until service return final result diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_revision_replicas_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_revision_replicas_operations.py index c38504879473..cbdac4a2e1de 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_revision_replicas_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_revision_replicas_operations.py @@ -26,7 +26,7 @@ def test_container_apps_revision_replicas_get_replica(self, resource_group): container_app_name="str", revision_name="str", replica_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -39,7 +39,7 @@ def test_container_apps_revision_replicas_list_replicas(self, resource_group): resource_group_name=resource_group.name, container_app_name="str", revision_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_revision_replicas_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_revision_replicas_operations_async.py index d23b27efd061..e4a72eefdd69 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_revision_replicas_operations_async.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_revision_replicas_operations_async.py @@ -27,7 +27,7 @@ async def test_container_apps_revision_replicas_get_replica(self, resource_group container_app_name="str", revision_name="str", replica_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -40,7 +40,7 @@ async def test_container_apps_revision_replicas_list_replicas(self, resource_gro resource_group_name=resource_group.name, container_app_name="str", revision_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_revisions_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_revisions_operations.py index a9f5286a688e..cf221fdc7812 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_revisions_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_revisions_operations.py @@ -24,7 +24,7 @@ def test_container_apps_revisions_list_revisions(self, resource_group): response = self.client.container_apps_revisions.list_revisions( resource_group_name=resource_group.name, container_app_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -37,7 +37,7 @@ def test_container_apps_revisions_get_revision(self, resource_group): resource_group_name=resource_group.name, container_app_name="str", revision_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -50,7 +50,7 @@ def test_container_apps_revisions_activate_revision(self, resource_group): resource_group_name=resource_group.name, container_app_name="str", revision_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -63,7 +63,7 @@ def test_container_apps_revisions_deactivate_revision(self, resource_group): resource_group_name=resource_group.name, container_app_name="str", revision_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -76,7 +76,7 @@ def test_container_apps_revisions_restart_revision(self, resource_group): resource_group_name=resource_group.name, container_app_name="str", revision_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_revisions_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_revisions_operations_async.py index 61767f087626..b6e5f60a3b33 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_revisions_operations_async.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_revisions_operations_async.py @@ -25,7 +25,7 @@ async def test_container_apps_revisions_list_revisions(self, resource_group): response = self.client.container_apps_revisions.list_revisions( resource_group_name=resource_group.name, container_app_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -38,7 +38,7 @@ async def test_container_apps_revisions_get_revision(self, resource_group): resource_group_name=resource_group.name, container_app_name="str", revision_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -51,7 +51,7 @@ async def test_container_apps_revisions_activate_revision(self, resource_group): resource_group_name=resource_group.name, container_app_name="str", revision_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -64,7 +64,7 @@ async def test_container_apps_revisions_deactivate_revision(self, resource_group resource_group_name=resource_group.name, container_app_name="str", revision_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -77,7 +77,7 @@ async def test_container_apps_revisions_restart_revision(self, resource_group): resource_group_name=resource_group.name, container_app_name="str", revision_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_session_pools_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_session_pools_operations.py index 76aad0dc33ea..0eb9577150dd 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_session_pools_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_session_pools_operations.py @@ -22,7 +22,7 @@ def setup_method(self, method): @recorded_by_proxy def test_container_apps_session_pools_list_by_subscription(self, resource_group): response = self.client.container_apps_session_pools.list_by_subscription( - api_version="2025-01-01", + api_version="2025-02-02-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -33,7 +33,7 @@ def test_container_apps_session_pools_list_by_subscription(self, resource_group) def test_container_apps_session_pools_list_by_resource_group(self, resource_group): response = self.client.container_apps_session_pools.list_by_resource_group( resource_group_name=resource_group.name, - api_version="2025-01-01", + api_version="2025-02-02-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -45,7 +45,7 @@ def test_container_apps_session_pools_get(self, resource_group): response = self.client.container_apps_session_pools.get( resource_group_name=resource_group.name, session_pool_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -68,6 +68,25 @@ def test_container_apps_session_pools_begin_create_or_update(self, resource_grou "env": [{"name": "str", "secretRef": "str", "value": "str"}], "image": "str", "name": "str", + "probes": [ + { + "failureThreshold": 0, + "httpGet": { + "port": 0, + "host": "str", + "httpHeaders": [{"name": "str", "value": "str"}], + "path": "str", + "scheme": "str", + }, + "initialDelaySeconds": 0, + "periodSeconds": 0, + "successThreshold": 0, + "tcpSocket": {"port": 0, "host": "str"}, + "terminationGracePeriodSeconds": 0, + "timeoutSeconds": 0, + "type": "str", + } + ], "resources": {"cpu": 0.0, "memory": "str"}, } ], @@ -114,7 +133,7 @@ def test_container_apps_session_pools_begin_create_or_update(self, resource_grou "tags": {"str": "str"}, "type": "str", }, - api_version="2025-01-01", + api_version="2025-02-02-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -135,6 +154,25 @@ def test_container_apps_session_pools_begin_update(self, resource_group): "env": [{"name": "str", "secretRef": "str", "value": "str"}], "image": "str", "name": "str", + "probes": [ + { + "failureThreshold": 0, + "httpGet": { + "port": 0, + "host": "str", + "httpHeaders": [{"name": "str", "value": "str"}], + "path": "str", + "scheme": "str", + }, + "initialDelaySeconds": 0, + "periodSeconds": 0, + "successThreshold": 0, + "tcpSocket": {"port": 0, "host": "str"}, + "terminationGracePeriodSeconds": 0, + "timeoutSeconds": 0, + "type": "str", + } + ], "resources": {"cpu": 0.0, "memory": "str"}, } ], @@ -164,7 +202,7 @@ def test_container_apps_session_pools_begin_update(self, resource_group): "sessionNetworkConfiguration": {"status": "str"}, "tags": {"str": "str"}, }, - api_version="2025-01-01", + api_version="2025-02-02-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -176,7 +214,7 @@ def test_container_apps_session_pools_begin_delete(self, resource_group): response = self.client.container_apps_session_pools.begin_delete( resource_group_name=resource_group.name, session_pool_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_session_pools_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_session_pools_operations_async.py index 2d64a8624a24..293c1fc05e42 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_session_pools_operations_async.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_session_pools_operations_async.py @@ -23,7 +23,7 @@ def setup_method(self, method): @recorded_by_proxy_async async def test_container_apps_session_pools_list_by_subscription(self, resource_group): response = self.client.container_apps_session_pools.list_by_subscription( - api_version="2025-01-01", + api_version="2025-02-02-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -34,7 +34,7 @@ async def test_container_apps_session_pools_list_by_subscription(self, resource_ async def test_container_apps_session_pools_list_by_resource_group(self, resource_group): response = self.client.container_apps_session_pools.list_by_resource_group( resource_group_name=resource_group.name, - api_version="2025-01-01", + api_version="2025-02-02-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -46,7 +46,7 @@ async def test_container_apps_session_pools_get(self, resource_group): response = await self.client.container_apps_session_pools.get( resource_group_name=resource_group.name, session_pool_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -70,6 +70,25 @@ async def test_container_apps_session_pools_begin_create_or_update(self, resourc "env": [{"name": "str", "secretRef": "str", "value": "str"}], "image": "str", "name": "str", + "probes": [ + { + "failureThreshold": 0, + "httpGet": { + "port": 0, + "host": "str", + "httpHeaders": [{"name": "str", "value": "str"}], + "path": "str", + "scheme": "str", + }, + "initialDelaySeconds": 0, + "periodSeconds": 0, + "successThreshold": 0, + "tcpSocket": {"port": 0, "host": "str"}, + "terminationGracePeriodSeconds": 0, + "timeoutSeconds": 0, + "type": "str", + } + ], "resources": {"cpu": 0.0, "memory": "str"}, } ], @@ -116,7 +135,7 @@ async def test_container_apps_session_pools_begin_create_or_update(self, resourc "tags": {"str": "str"}, "type": "str", }, - api_version="2025-01-01", + api_version="2025-02-02-preview", ) ).result() # call '.result()' to poll until service return final result @@ -139,6 +158,25 @@ async def test_container_apps_session_pools_begin_update(self, resource_group): "env": [{"name": "str", "secretRef": "str", "value": "str"}], "image": "str", "name": "str", + "probes": [ + { + "failureThreshold": 0, + "httpGet": { + "port": 0, + "host": "str", + "httpHeaders": [{"name": "str", "value": "str"}], + "path": "str", + "scheme": "str", + }, + "initialDelaySeconds": 0, + "periodSeconds": 0, + "successThreshold": 0, + "tcpSocket": {"port": 0, "host": "str"}, + "terminationGracePeriodSeconds": 0, + "timeoutSeconds": 0, + "type": "str", + } + ], "resources": {"cpu": 0.0, "memory": "str"}, } ], @@ -168,7 +206,7 @@ async def test_container_apps_session_pools_begin_update(self, resource_group): "sessionNetworkConfiguration": {"status": "str"}, "tags": {"str": "str"}, }, - api_version="2025-01-01", + api_version="2025-02-02-preview", ) ).result() # call '.result()' to poll until service return final result @@ -182,7 +220,7 @@ async def test_container_apps_session_pools_begin_delete(self, resource_group): await self.client.container_apps_session_pools.begin_delete( resource_group_name=resource_group.name, session_pool_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) ).result() # call '.result()' to poll until service return final result diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_source_controls_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_source_controls_operations.py index cbaadc2d8f06..26c71bf54f7c 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_source_controls_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_source_controls_operations.py @@ -24,7 +24,7 @@ def test_container_apps_source_controls_list_by_container_app(self, resource_gro response = self.client.container_apps_source_controls.list_by_container_app( resource_group_name=resource_group.name, container_app_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -37,7 +37,7 @@ def test_container_apps_source_controls_get(self, resource_group): resource_group_name=resource_group.name, container_app_name="str", source_control_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -60,7 +60,9 @@ def test_container_apps_source_controls_begin_create_or_update(self, resource_gr "subscriptionId": "str", "tenantId": "str", }, + "buildEnvironmentVariables": [{"name": "str", "value": "str"}], "contextPath": "str", + "dockerfilePath": "str", "githubPersonalAccessToken": "str", "image": "str", "os": "str", @@ -83,7 +85,7 @@ def test_container_apps_source_controls_begin_create_or_update(self, resource_gr }, "type": "str", }, - api_version="2025-01-01", + api_version="2025-02-02-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -96,7 +98,7 @@ def test_container_apps_source_controls_begin_delete(self, resource_group): resource_group_name=resource_group.name, container_app_name="str", source_control_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_source_controls_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_source_controls_operations_async.py index c96811cbf602..1c90da3844f0 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_source_controls_operations_async.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_source_controls_operations_async.py @@ -25,7 +25,7 @@ async def test_container_apps_source_controls_list_by_container_app(self, resour response = self.client.container_apps_source_controls.list_by_container_app( resource_group_name=resource_group.name, container_app_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -38,7 +38,7 @@ async def test_container_apps_source_controls_get(self, resource_group): resource_group_name=resource_group.name, container_app_name="str", source_control_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -62,7 +62,9 @@ async def test_container_apps_source_controls_begin_create_or_update(self, resou "subscriptionId": "str", "tenantId": "str", }, + "buildEnvironmentVariables": [{"name": "str", "value": "str"}], "contextPath": "str", + "dockerfilePath": "str", "githubPersonalAccessToken": "str", "image": "str", "os": "str", @@ -85,7 +87,7 @@ async def test_container_apps_source_controls_begin_create_or_update(self, resou }, "type": "str", }, - api_version="2025-01-01", + api_version="2025-02-02-preview", ) ).result() # call '.result()' to poll until service return final result @@ -100,7 +102,7 @@ async def test_container_apps_source_controls_begin_delete(self, resource_group) resource_group_name=resource_group.name, container_app_name="str", source_control_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) ).result() # call '.result()' to poll until service return final result diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dapr_component_resiliency_policies_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dapr_component_resiliency_policies_operations.py index 3147d365491d..557524c79042 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dapr_component_resiliency_policies_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dapr_component_resiliency_policies_operations.py @@ -20,12 +20,12 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list(self, resource_group): + def test_dapr_component_resiliency_policies_list(self, resource_group): response = self.client.dapr_component_resiliency_policies.list( resource_group_name=resource_group.name, environment_name="str", component_name="str", - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -33,13 +33,13 @@ def test_list(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_dapr_component_resiliency_policies_get(self, resource_group): response = self.client.dapr_component_resiliency_policies.get( resource_group_name=resource_group.name, environment_name="str", component_name="str", name="str", - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -47,7 +47,7 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_create_or_update(self, resource_group): + def test_dapr_component_resiliency_policies_create_or_update(self, resource_group): response = self.client.dapr_component_resiliency_policies.create_or_update( resource_group_name=resource_group.name, environment_name="str", @@ -82,7 +82,7 @@ def test_create_or_update(self, resource_group): }, "type": "str", }, - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -90,13 +90,13 @@ def test_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_delete(self, resource_group): + def test_dapr_component_resiliency_policies_delete(self, resource_group): response = self.client.dapr_component_resiliency_policies.delete( resource_group_name=resource_group.name, environment_name="str", component_name="str", name="str", - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dapr_component_resiliency_policies_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dapr_component_resiliency_policies_operations_async.py index fc06f53a0604..7a5e916fd530 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dapr_component_resiliency_policies_operations_async.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dapr_component_resiliency_policies_operations_async.py @@ -21,12 +21,12 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list(self, resource_group): + async def test_dapr_component_resiliency_policies_list(self, resource_group): response = self.client.dapr_component_resiliency_policies.list( resource_group_name=resource_group.name, environment_name="str", component_name="str", - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -34,13 +34,13 @@ async def test_list(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_dapr_component_resiliency_policies_get(self, resource_group): response = await self.client.dapr_component_resiliency_policies.get( resource_group_name=resource_group.name, environment_name="str", component_name="str", name="str", - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -48,7 +48,7 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_create_or_update(self, resource_group): + async def test_dapr_component_resiliency_policies_create_or_update(self, resource_group): response = await self.client.dapr_component_resiliency_policies.create_or_update( resource_group_name=resource_group.name, environment_name="str", @@ -83,7 +83,7 @@ async def test_create_or_update(self, resource_group): }, "type": "str", }, - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -91,13 +91,13 @@ async def test_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_delete(self, resource_group): + async def test_dapr_component_resiliency_policies_delete(self, resource_group): response = await self.client.dapr_component_resiliency_policies.delete( resource_group_name=resource_group.name, environment_name="str", component_name="str", name="str", - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dapr_components_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dapr_components_operations.py index 67620925bfe1..58df866d8cf5 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dapr_components_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dapr_components_operations.py @@ -24,7 +24,7 @@ def test_dapr_components_list(self, resource_group): response = self.client.dapr_components.list( resource_group_name=resource_group.name, environment_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -37,7 +37,7 @@ def test_dapr_components_get(self, resource_group): resource_group_name=resource_group.name, environment_name="str", component_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -60,6 +60,9 @@ def test_dapr_components_create_or_update(self, resource_group): "scopes": ["str"], "secretStoreComponent": "str", "secrets": [{"identity": "str", "keyVaultUrl": "str", "name": "str", "value": "str"}], + "serviceComponentBind": [ + {"metadata": {"name": "str", "value": "str"}, "name": "str", "serviceId": "str"} + ], "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -71,7 +74,7 @@ def test_dapr_components_create_or_update(self, resource_group): "type": "str", "version": "str", }, - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -84,7 +87,7 @@ def test_dapr_components_delete(self, resource_group): resource_group_name=resource_group.name, environment_name="str", component_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -97,7 +100,7 @@ def test_dapr_components_list_secrets(self, resource_group): resource_group_name=resource_group.name, environment_name="str", component_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dapr_components_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dapr_components_operations_async.py index 39ad80091bbd..934caa10ee47 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dapr_components_operations_async.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dapr_components_operations_async.py @@ -25,7 +25,7 @@ async def test_dapr_components_list(self, resource_group): response = self.client.dapr_components.list( resource_group_name=resource_group.name, environment_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -38,7 +38,7 @@ async def test_dapr_components_get(self, resource_group): resource_group_name=resource_group.name, environment_name="str", component_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -61,6 +61,9 @@ async def test_dapr_components_create_or_update(self, resource_group): "scopes": ["str"], "secretStoreComponent": "str", "secrets": [{"identity": "str", "keyVaultUrl": "str", "name": "str", "value": "str"}], + "serviceComponentBind": [ + {"metadata": {"name": "str", "value": "str"}, "name": "str", "serviceId": "str"} + ], "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -72,7 +75,7 @@ async def test_dapr_components_create_or_update(self, resource_group): "type": "str", "version": "str", }, - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -85,7 +88,7 @@ async def test_dapr_components_delete(self, resource_group): resource_group_name=resource_group.name, environment_name="str", component_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -98,7 +101,7 @@ async def test_dapr_components_list_secrets(self, resource_group): resource_group_name=resource_group.name, environment_name="str", component_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dapr_subscriptions_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dapr_subscriptions_operations.py index 49197250bc40..a734af35d3df 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dapr_subscriptions_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dapr_subscriptions_operations.py @@ -20,11 +20,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list(self, resource_group): + def test_dapr_subscriptions_list(self, resource_group): response = self.client.dapr_subscriptions.list( resource_group_name=resource_group.name, environment_name="str", - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -32,12 +32,12 @@ def test_list(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_dapr_subscriptions_get(self, resource_group): response = self.client.dapr_subscriptions.get( resource_group_name=resource_group.name, environment_name="str", name="str", - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -45,7 +45,7 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_create_or_update(self, resource_group): + def test_dapr_subscriptions_create_or_update(self, resource_group): response = self.client.dapr_subscriptions.create_or_update( resource_group_name=resource_group.name, environment_name="str", @@ -70,7 +70,7 @@ def test_create_or_update(self, resource_group): "topic": "str", "type": "str", }, - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -78,12 +78,12 @@ def test_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_delete(self, resource_group): + def test_dapr_subscriptions_delete(self, resource_group): response = self.client.dapr_subscriptions.delete( resource_group_name=resource_group.name, environment_name="str", name="str", - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dapr_subscriptions_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dapr_subscriptions_operations_async.py index 9038a3c23b75..c52ba55c3a9e 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dapr_subscriptions_operations_async.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dapr_subscriptions_operations_async.py @@ -21,11 +21,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list(self, resource_group): + async def test_dapr_subscriptions_list(self, resource_group): response = self.client.dapr_subscriptions.list( resource_group_name=resource_group.name, environment_name="str", - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -33,12 +33,12 @@ async def test_list(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_dapr_subscriptions_get(self, resource_group): response = await self.client.dapr_subscriptions.get( resource_group_name=resource_group.name, environment_name="str", name="str", - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -46,7 +46,7 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_create_or_update(self, resource_group): + async def test_dapr_subscriptions_create_or_update(self, resource_group): response = await self.client.dapr_subscriptions.create_or_update( resource_group_name=resource_group.name, environment_name="str", @@ -71,7 +71,7 @@ async def test_create_or_update(self, resource_group): "topic": "str", "type": "str", }, - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -79,12 +79,12 @@ async def test_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_delete(self, resource_group): + async def test_dapr_subscriptions_delete(self, resource_group): response = await self.client.dapr_subscriptions.delete( resource_group_name=resource_group.name, environment_name="str", name="str", - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dot_net_components_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dot_net_components_operations.py index 72a4e436436f..436a27131b9a 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dot_net_components_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dot_net_components_operations.py @@ -20,11 +20,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list(self, resource_group): + def test_dot_net_components_list(self, resource_group): response = self.client.dot_net_components.list( resource_group_name=resource_group.name, environment_name="str", - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -32,12 +32,12 @@ def test_list(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_dot_net_components_get(self, resource_group): response = self.client.dot_net_components.get( resource_group_name=resource_group.name, environment_name="str", name="str", - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -45,7 +45,7 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_create_or_update(self, resource_group): + def test_dot_net_components_begin_create_or_update(self, resource_group): response = self.client.dot_net_components.begin_create_or_update( resource_group_name=resource_group.name, environment_name="str", @@ -67,7 +67,7 @@ def test_begin_create_or_update(self, resource_group): }, "type": "str", }, - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -75,7 +75,7 @@ def test_begin_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_update(self, resource_group): + def test_dot_net_components_begin_update(self, resource_group): response = self.client.dot_net_components.begin_update( resource_group_name=resource_group.name, environment_name="str", @@ -97,7 +97,7 @@ def test_begin_update(self, resource_group): }, "type": "str", }, - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -105,12 +105,12 @@ def test_begin_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_delete(self, resource_group): + def test_dot_net_components_begin_delete(self, resource_group): response = self.client.dot_net_components.begin_delete( resource_group_name=resource_group.name, environment_name="str", name="str", - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dot_net_components_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dot_net_components_operations_async.py index 1e6a8021baa2..f4731eb3c2fa 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dot_net_components_operations_async.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dot_net_components_operations_async.py @@ -21,11 +21,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list(self, resource_group): + async def test_dot_net_components_list(self, resource_group): response = self.client.dot_net_components.list( resource_group_name=resource_group.name, environment_name="str", - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -33,12 +33,12 @@ async def test_list(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_dot_net_components_get(self, resource_group): response = await self.client.dot_net_components.get( resource_group_name=resource_group.name, environment_name="str", name="str", - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -46,7 +46,7 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_create_or_update(self, resource_group): + async def test_dot_net_components_begin_create_or_update(self, resource_group): response = await ( await self.client.dot_net_components.begin_create_or_update( resource_group_name=resource_group.name, @@ -69,7 +69,7 @@ async def test_begin_create_or_update(self, resource_group): }, "type": "str", }, - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ) ).result() # call '.result()' to poll until service return final result @@ -78,7 +78,7 @@ async def test_begin_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_update(self, resource_group): + async def test_dot_net_components_begin_update(self, resource_group): response = await ( await self.client.dot_net_components.begin_update( resource_group_name=resource_group.name, @@ -101,7 +101,7 @@ async def test_begin_update(self, resource_group): }, "type": "str", }, - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ) ).result() # call '.result()' to poll until service return final result @@ -110,13 +110,13 @@ async def test_begin_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_delete(self, resource_group): + async def test_dot_net_components_begin_delete(self, resource_group): response = await ( await self.client.dot_net_components.begin_delete( resource_group_name=resource_group.name, environment_name="str", name="str", - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ) ).result() # call '.result()' to poll until service return final result diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_functions_extension_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_functions_extension_operations.py index 743c92817f33..145cf14131d6 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_functions_extension_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_functions_extension_operations.py @@ -20,13 +20,13 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_invoke_functions_host(self, resource_group): + def test_functions_extension_invoke_functions_host(self, resource_group): response = self.client.functions_extension.invoke_functions_host( resource_group_name=resource_group.name, container_app_name="str", revision_name="str", function_app_name="str", - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_functions_extension_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_functions_extension_operations_async.py index 7601b17d79b5..cfaf7a6b0f21 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_functions_extension_operations_async.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_functions_extension_operations_async.py @@ -21,13 +21,13 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_invoke_functions_host(self, resource_group): + async def test_functions_extension_invoke_functions_host(self, resource_group): response = await self.client.functions_extension.invoke_functions_host( resource_group_name=resource_group.name, container_app_name="str", revision_name="str", function_app_name="str", - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_http_route_config_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_http_route_config_operations.py new file mode 100644 index 000000000000..e78a328e7ffd --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_http_route_config_operations.py @@ -0,0 +1,119 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIHttpRouteConfigOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_http_route_config_get(self, resource_group): + response = self.client.http_route_config.get( + resource_group_name=resource_group.name, + environment_name="str", + http_route_name="str", + api_version="2025-02-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_http_route_config_create_or_update(self, resource_group): + response = self.client.http_route_config.create_or_update( + resource_group_name=resource_group.name, + environment_name="str", + http_route_name="str", + api_version="2025-02-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_http_route_config_update(self, resource_group): + response = self.client.http_route_config.update( + resource_group_name=resource_group.name, + environment_name="str", + http_route_name="str", + http_route_config_envelope={ + "id": "str", + "name": "str", + "properties": { + "customDomains": [{"name": "str", "bindingType": "str", "certificateId": "str"}], + "fqdn": "str", + "provisioningErrors": [{"message": "str", "timestamp": "2020-02-20 00:00:00"}], + "provisioningState": "str", + "rules": [ + { + "description": "str", + "routes": [ + { + "action": {"prefixRewrite": "str"}, + "match": { + "caseSensitive": bool, + "path": "str", + "pathSeparatedPrefix": "str", + "prefix": "str", + }, + } + ], + "targets": [{"containerApp": "str", "label": "str", "revision": "str", "weight": 0}], + } + ], + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2025-02-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_http_route_config_delete(self, resource_group): + response = self.client.http_route_config.delete( + resource_group_name=resource_group.name, + environment_name="str", + http_route_name="str", + api_version="2025-02-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_http_route_config_list(self, resource_group): + response = self.client.http_route_config.list( + resource_group_name=resource_group.name, + environment_name="str", + api_version="2025-02-02-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_http_route_config_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_http_route_config_operations_async.py new file mode 100644 index 000000000000..52164ddf2226 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_http_route_config_operations_async.py @@ -0,0 +1,120 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIHttpRouteConfigOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_http_route_config_get(self, resource_group): + response = await self.client.http_route_config.get( + resource_group_name=resource_group.name, + environment_name="str", + http_route_name="str", + api_version="2025-02-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_http_route_config_create_or_update(self, resource_group): + response = await self.client.http_route_config.create_or_update( + resource_group_name=resource_group.name, + environment_name="str", + http_route_name="str", + api_version="2025-02-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_http_route_config_update(self, resource_group): + response = await self.client.http_route_config.update( + resource_group_name=resource_group.name, + environment_name="str", + http_route_name="str", + http_route_config_envelope={ + "id": "str", + "name": "str", + "properties": { + "customDomains": [{"name": "str", "bindingType": "str", "certificateId": "str"}], + "fqdn": "str", + "provisioningErrors": [{"message": "str", "timestamp": "2020-02-20 00:00:00"}], + "provisioningState": "str", + "rules": [ + { + "description": "str", + "routes": [ + { + "action": {"prefixRewrite": "str"}, + "match": { + "caseSensitive": bool, + "path": "str", + "pathSeparatedPrefix": "str", + "prefix": "str", + }, + } + ], + "targets": [{"containerApp": "str", "label": "str", "revision": "str", "weight": 0}], + } + ], + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2025-02-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_http_route_config_delete(self, resource_group): + response = await self.client.http_route_config.delete( + resource_group_name=resource_group.name, + environment_name="str", + http_route_name="str", + api_version="2025-02-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_http_route_config_list(self, resource_group): + response = self.client.http_route_config.list( + resource_group_name=resource_group.name, + environment_name="str", + api_version="2025-02-02-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_java_components_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_java_components_operations.py index 79095d832b2c..cf180c7b9af1 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_java_components_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_java_components_operations.py @@ -24,7 +24,7 @@ def test_java_components_list(self, resource_group): response = self.client.java_components.list( resource_group_name=resource_group.name, environment_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -37,7 +37,7 @@ def test_java_components_get(self, resource_group): resource_group_name=resource_group.name, environment_name="str", name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -64,7 +64,7 @@ def test_java_components_begin_create_or_update(self, resource_group): }, "type": "str", }, - api_version="2025-01-01", + api_version="2025-02-02-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -91,7 +91,7 @@ def test_java_components_begin_update(self, resource_group): }, "type": "str", }, - api_version="2025-01-01", + api_version="2025-02-02-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -104,7 +104,7 @@ def test_java_components_begin_delete(self, resource_group): resource_group_name=resource_group.name, environment_name="str", name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_java_components_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_java_components_operations_async.py index 6a0d1a40db2c..ceb7694d36d9 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_java_components_operations_async.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_java_components_operations_async.py @@ -25,7 +25,7 @@ async def test_java_components_list(self, resource_group): response = self.client.java_components.list( resource_group_name=resource_group.name, environment_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -38,7 +38,7 @@ async def test_java_components_get(self, resource_group): resource_group_name=resource_group.name, environment_name="str", name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -66,7 +66,7 @@ async def test_java_components_begin_create_or_update(self, resource_group): }, "type": "str", }, - api_version="2025-01-01", + api_version="2025-02-02-preview", ) ).result() # call '.result()' to poll until service return final result @@ -95,7 +95,7 @@ async def test_java_components_begin_update(self, resource_group): }, "type": "str", }, - api_version="2025-01-01", + api_version="2025-02-02-preview", ) ).result() # call '.result()' to poll until service return final result @@ -110,7 +110,7 @@ async def test_java_components_begin_delete(self, resource_group): resource_group_name=resource_group.name, environment_name="str", name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) ).result() # call '.result()' to poll until service return final result diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_jobs_executions_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_jobs_executions_operations.py index b0a3bf9a74c0..bb39de112cee 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_jobs_executions_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_jobs_executions_operations.py @@ -24,7 +24,7 @@ def test_jobs_executions_list(self, resource_group): response = self.client.jobs_executions.list( resource_group_name=resource_group.name, job_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_jobs_executions_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_jobs_executions_operations_async.py index ac06b2710202..c69a2747dc72 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_jobs_executions_operations_async.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_jobs_executions_operations_async.py @@ -25,7 +25,7 @@ async def test_jobs_executions_list(self, resource_group): response = self.client.jobs_executions.list( resource_group_name=resource_group.name, job_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_jobs_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_jobs_operations.py index 2d7d2c3e5cdf..0b3528c5fa33 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_jobs_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_jobs_operations.py @@ -24,7 +24,7 @@ def test_jobs_list_detectors(self, resource_group): response = self.client.jobs.list_detectors( resource_group_name=resource_group.name, job_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -37,7 +37,7 @@ def test_jobs_get_detector(self, resource_group): resource_group_name=resource_group.name, job_name="str", detector_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -50,7 +50,7 @@ def test_jobs_proxy_get(self, resource_group): resource_group_name=resource_group.name, job_name="str", api_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -60,7 +60,7 @@ def test_jobs_proxy_get(self, resource_group): @recorded_by_proxy def test_jobs_list_by_subscription(self, resource_group): response = self.client.jobs.list_by_subscription( - api_version="2025-01-01", + api_version="2025-02-02-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -71,7 +71,7 @@ def test_jobs_list_by_subscription(self, resource_group): def test_jobs_list_by_resource_group(self, resource_group): response = self.client.jobs.list_by_resource_group( resource_group_name=resource_group.name, - api_version="2025-01-01", + api_version="2025-02-02-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -83,7 +83,7 @@ def test_jobs_get(self, resource_group): response = self.client.jobs.get( resource_group_name=resource_group.name, job_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -127,6 +127,7 @@ def test_jobs_begin_create_or_update(self, resource_group): }, "environmentId": "str", "eventStreamEndpoint": "str", + "extendedLocation": {"name": "str", "type": "str"}, "id": "str", "identity": { "type": "str", @@ -137,6 +138,7 @@ def test_jobs_begin_create_or_update(self, resource_group): "name": "str", "outboundIpAddresses": ["str"], "provisioningState": "str", + "runningState": "str", "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -153,6 +155,7 @@ def test_jobs_begin_create_or_update(self, resource_group): "command": ["str"], "env": [{"name": "str", "secretRef": "str", "value": "str"}], "image": "str", + "imageType": "str", "name": "str", "probes": [ { @@ -173,7 +176,7 @@ def test_jobs_begin_create_or_update(self, resource_group): "type": "str", } ], - "resources": {"cpu": 0.0, "ephemeralStorage": "str", "memory": "str"}, + "resources": {"cpu": 0.0, "ephemeralStorage": "str", "gpu": 0.0, "memory": "str"}, "volumeMounts": [{"mountPath": "str", "subPath": "str", "volumeName": "str"}], } ], @@ -183,8 +186,9 @@ def test_jobs_begin_create_or_update(self, resource_group): "command": ["str"], "env": [{"name": "str", "secretRef": "str", "value": "str"}], "image": "str", + "imageType": "str", "name": "str", - "resources": {"cpu": 0.0, "ephemeralStorage": "str", "memory": "str"}, + "resources": {"cpu": 0.0, "ephemeralStorage": "str", "gpu": 0.0, "memory": "str"}, "volumeMounts": [{"mountPath": "str", "subPath": "str", "volumeName": "str"}], } ], @@ -201,7 +205,7 @@ def test_jobs_begin_create_or_update(self, resource_group): "type": "str", "workloadProfileName": "str", }, - api_version="2025-01-01", + api_version="2025-02-02-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -213,7 +217,7 @@ def test_jobs_begin_delete(self, resource_group): response = self.client.jobs.begin_delete( resource_group_name=resource_group.name, job_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -226,6 +230,7 @@ def test_jobs_begin_update(self, resource_group): resource_group_name=resource_group.name, job_name="str", job_envelope={ + "extendedLocation": {"name": "str", "type": "str"}, "identity": { "type": "str", "principalId": "str", @@ -277,6 +282,7 @@ def test_jobs_begin_update(self, resource_group): "command": ["str"], "env": [{"name": "str", "secretRef": "str", "value": "str"}], "image": "str", + "imageType": "str", "name": "str", "probes": [ { @@ -297,7 +303,7 @@ def test_jobs_begin_update(self, resource_group): "type": "str", } ], - "resources": {"cpu": 0.0, "ephemeralStorage": "str", "memory": "str"}, + "resources": {"cpu": 0.0, "ephemeralStorage": "str", "gpu": 0.0, "memory": "str"}, "volumeMounts": [{"mountPath": "str", "subPath": "str", "volumeName": "str"}], } ], @@ -307,8 +313,9 @@ def test_jobs_begin_update(self, resource_group): "command": ["str"], "env": [{"name": "str", "secretRef": "str", "value": "str"}], "image": "str", + "imageType": "str", "name": "str", - "resources": {"cpu": 0.0, "ephemeralStorage": "str", "memory": "str"}, + "resources": {"cpu": 0.0, "ephemeralStorage": "str", "gpu": 0.0, "memory": "str"}, "volumeMounts": [{"mountPath": "str", "subPath": "str", "volumeName": "str"}], } ], @@ -325,7 +332,7 @@ def test_jobs_begin_update(self, resource_group): }, "tags": {"str": "str"}, }, - api_version="2025-01-01", + api_version="2025-02-02-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -337,7 +344,7 @@ def test_jobs_begin_start(self, resource_group): response = self.client.jobs.begin_start( resource_group_name=resource_group.name, job_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -350,7 +357,7 @@ def test_jobs_begin_stop_execution(self, resource_group): resource_group_name=resource_group.name, job_name="str", job_execution_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -362,7 +369,7 @@ def test_jobs_begin_stop_multiple_executions(self, resource_group): response = self.client.jobs.begin_stop_multiple_executions( resource_group_name=resource_group.name, job_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -374,8 +381,32 @@ def test_jobs_list_secrets(self, resource_group): response = self.client.jobs.list_secrets( resource_group_name=resource_group.name, job_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_jobs_begin_resume(self, resource_group): + response = self.client.jobs.begin_resume( + resource_group_name=resource_group.name, + job_name="str", + api_version="2025-02-02-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_jobs_begin_suspend(self, resource_group): + response = self.client.jobs.begin_suspend( + resource_group_name=resource_group.name, + job_name="str", + api_version="2025-02-02-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_jobs_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_jobs_operations_async.py index 2c331c20d397..89d7ae875ceb 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_jobs_operations_async.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_jobs_operations_async.py @@ -25,7 +25,7 @@ async def test_jobs_list_detectors(self, resource_group): response = self.client.jobs.list_detectors( resource_group_name=resource_group.name, job_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -38,7 +38,7 @@ async def test_jobs_get_detector(self, resource_group): resource_group_name=resource_group.name, job_name="str", detector_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -51,7 +51,7 @@ async def test_jobs_proxy_get(self, resource_group): resource_group_name=resource_group.name, job_name="str", api_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -61,7 +61,7 @@ async def test_jobs_proxy_get(self, resource_group): @recorded_by_proxy_async async def test_jobs_list_by_subscription(self, resource_group): response = self.client.jobs.list_by_subscription( - api_version="2025-01-01", + api_version="2025-02-02-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -72,7 +72,7 @@ async def test_jobs_list_by_subscription(self, resource_group): async def test_jobs_list_by_resource_group(self, resource_group): response = self.client.jobs.list_by_resource_group( resource_group_name=resource_group.name, - api_version="2025-01-01", + api_version="2025-02-02-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -84,7 +84,7 @@ async def test_jobs_get(self, resource_group): response = await self.client.jobs.get( resource_group_name=resource_group.name, job_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -135,6 +135,7 @@ async def test_jobs_begin_create_or_update(self, resource_group): }, "environmentId": "str", "eventStreamEndpoint": "str", + "extendedLocation": {"name": "str", "type": "str"}, "id": "str", "identity": { "type": "str", @@ -145,6 +146,7 @@ async def test_jobs_begin_create_or_update(self, resource_group): "name": "str", "outboundIpAddresses": ["str"], "provisioningState": "str", + "runningState": "str", "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -161,6 +163,7 @@ async def test_jobs_begin_create_or_update(self, resource_group): "command": ["str"], "env": [{"name": "str", "secretRef": "str", "value": "str"}], "image": "str", + "imageType": "str", "name": "str", "probes": [ { @@ -181,7 +184,7 @@ async def test_jobs_begin_create_or_update(self, resource_group): "type": "str", } ], - "resources": {"cpu": 0.0, "ephemeralStorage": "str", "memory": "str"}, + "resources": {"cpu": 0.0, "ephemeralStorage": "str", "gpu": 0.0, "memory": "str"}, "volumeMounts": [{"mountPath": "str", "subPath": "str", "volumeName": "str"}], } ], @@ -191,8 +194,9 @@ async def test_jobs_begin_create_or_update(self, resource_group): "command": ["str"], "env": [{"name": "str", "secretRef": "str", "value": "str"}], "image": "str", + "imageType": "str", "name": "str", - "resources": {"cpu": 0.0, "ephemeralStorage": "str", "memory": "str"}, + "resources": {"cpu": 0.0, "ephemeralStorage": "str", "gpu": 0.0, "memory": "str"}, "volumeMounts": [{"mountPath": "str", "subPath": "str", "volumeName": "str"}], } ], @@ -209,7 +213,7 @@ async def test_jobs_begin_create_or_update(self, resource_group): "type": "str", "workloadProfileName": "str", }, - api_version="2025-01-01", + api_version="2025-02-02-preview", ) ).result() # call '.result()' to poll until service return final result @@ -223,7 +227,7 @@ async def test_jobs_begin_delete(self, resource_group): await self.client.jobs.begin_delete( resource_group_name=resource_group.name, job_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) ).result() # call '.result()' to poll until service return final result @@ -238,6 +242,7 @@ async def test_jobs_begin_update(self, resource_group): resource_group_name=resource_group.name, job_name="str", job_envelope={ + "extendedLocation": {"name": "str", "type": "str"}, "identity": { "type": "str", "principalId": "str", @@ -289,6 +294,7 @@ async def test_jobs_begin_update(self, resource_group): "command": ["str"], "env": [{"name": "str", "secretRef": "str", "value": "str"}], "image": "str", + "imageType": "str", "name": "str", "probes": [ { @@ -309,7 +315,7 @@ async def test_jobs_begin_update(self, resource_group): "type": "str", } ], - "resources": {"cpu": 0.0, "ephemeralStorage": "str", "memory": "str"}, + "resources": {"cpu": 0.0, "ephemeralStorage": "str", "gpu": 0.0, "memory": "str"}, "volumeMounts": [{"mountPath": "str", "subPath": "str", "volumeName": "str"}], } ], @@ -319,8 +325,9 @@ async def test_jobs_begin_update(self, resource_group): "command": ["str"], "env": [{"name": "str", "secretRef": "str", "value": "str"}], "image": "str", + "imageType": "str", "name": "str", - "resources": {"cpu": 0.0, "ephemeralStorage": "str", "memory": "str"}, + "resources": {"cpu": 0.0, "ephemeralStorage": "str", "gpu": 0.0, "memory": "str"}, "volumeMounts": [{"mountPath": "str", "subPath": "str", "volumeName": "str"}], } ], @@ -337,7 +344,7 @@ async def test_jobs_begin_update(self, resource_group): }, "tags": {"str": "str"}, }, - api_version="2025-01-01", + api_version="2025-02-02-preview", ) ).result() # call '.result()' to poll until service return final result @@ -351,7 +358,7 @@ async def test_jobs_begin_start(self, resource_group): await self.client.jobs.begin_start( resource_group_name=resource_group.name, job_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) ).result() # call '.result()' to poll until service return final result @@ -366,7 +373,7 @@ async def test_jobs_begin_stop_execution(self, resource_group): resource_group_name=resource_group.name, job_name="str", job_execution_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) ).result() # call '.result()' to poll until service return final result @@ -380,7 +387,7 @@ async def test_jobs_begin_stop_multiple_executions(self, resource_group): await self.client.jobs.begin_stop_multiple_executions( resource_group_name=resource_group.name, job_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) ).result() # call '.result()' to poll until service return final result @@ -393,8 +400,36 @@ async def test_jobs_list_secrets(self, resource_group): response = await self.client.jobs.list_secrets( resource_group_name=resource_group.name, job_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_jobs_begin_resume(self, resource_group): + response = await ( + await self.client.jobs.begin_resume( + resource_group_name=resource_group.name, + job_name="str", + api_version="2025-02-02-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_jobs_begin_suspend(self, resource_group): + response = await ( + await self.client.jobs.begin_suspend( + resource_group_name=resource_group.name, + job_name="str", + api_version="2025-02-02-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_logic_apps_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_logic_apps_operations.py index 1d4536c74063..ef8164581cad 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_logic_apps_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_logic_apps_operations.py @@ -20,12 +20,12 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_logic_apps_get(self, resource_group): response = self.client.logic_apps.get( resource_group_name=resource_group.name, container_app_name="str", logic_app_name="str", - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -33,7 +33,7 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_create_or_update(self, resource_group): + def test_logic_apps_create_or_update(self, resource_group): response = self.client.logic_apps.create_or_update( resource_group_name=resource_group.name, container_app_name="str", @@ -52,7 +52,7 @@ def test_create_or_update(self, resource_group): }, "type": "str", }, - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -60,12 +60,12 @@ def test_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_delete(self, resource_group): + def test_logic_apps_delete(self, resource_group): response = self.client.logic_apps.delete( resource_group_name=resource_group.name, container_app_name="str", logic_app_name="str", - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -73,12 +73,12 @@ def test_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_workflows(self, resource_group): + def test_logic_apps_list_workflows(self, resource_group): response = self.client.logic_apps.list_workflows( resource_group_name=resource_group.name, container_app_name="str", logic_app_name="str", - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -86,13 +86,13 @@ def test_list_workflows(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get_workflow(self, resource_group): + def test_logic_apps_get_workflow(self, resource_group): response = self.client.logic_apps.get_workflow( resource_group_name=resource_group.name, container_app_name="str", logic_app_name="str", workflow_name="str", - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -100,12 +100,12 @@ def test_get_workflow(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_deploy_workflow_artifacts(self, resource_group): + def test_logic_apps_deploy_workflow_artifacts(self, resource_group): response = self.client.logic_apps.deploy_workflow_artifacts( resource_group_name=resource_group.name, container_app_name="str", logic_app_name="str", - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -113,12 +113,12 @@ def test_deploy_workflow_artifacts(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_workflows_connections(self, resource_group): + def test_logic_apps_list_workflows_connections(self, resource_group): response = self.client.logic_apps.list_workflows_connections( resource_group_name=resource_group.name, container_app_name="str", logic_app_name="str", - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -126,14 +126,14 @@ def test_list_workflows_connections(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_invoke(self, resource_group): + def test_logic_apps_invoke(self, resource_group): response = self.client.logic_apps.invoke( resource_group_name=resource_group.name, container_app_name="str", logic_app_name="str", x_ms_logic_apps_proxy_path="str", x_ms_logic_apps_proxy_method="str", - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_logic_apps_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_logic_apps_operations_async.py index 76a868a54901..015c42cbbedb 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_logic_apps_operations_async.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_logic_apps_operations_async.py @@ -21,12 +21,12 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_logic_apps_get(self, resource_group): response = await self.client.logic_apps.get( resource_group_name=resource_group.name, container_app_name="str", logic_app_name="str", - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -34,7 +34,7 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_create_or_update(self, resource_group): + async def test_logic_apps_create_or_update(self, resource_group): response = await self.client.logic_apps.create_or_update( resource_group_name=resource_group.name, container_app_name="str", @@ -53,7 +53,7 @@ async def test_create_or_update(self, resource_group): }, "type": "str", }, - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -61,12 +61,12 @@ async def test_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_delete(self, resource_group): + async def test_logic_apps_delete(self, resource_group): response = await self.client.logic_apps.delete( resource_group_name=resource_group.name, container_app_name="str", logic_app_name="str", - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -74,12 +74,12 @@ async def test_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_workflows(self, resource_group): + async def test_logic_apps_list_workflows(self, resource_group): response = self.client.logic_apps.list_workflows( resource_group_name=resource_group.name, container_app_name="str", logic_app_name="str", - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -87,13 +87,13 @@ async def test_list_workflows(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get_workflow(self, resource_group): + async def test_logic_apps_get_workflow(self, resource_group): response = await self.client.logic_apps.get_workflow( resource_group_name=resource_group.name, container_app_name="str", logic_app_name="str", workflow_name="str", - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -101,12 +101,12 @@ async def test_get_workflow(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_deploy_workflow_artifacts(self, resource_group): + async def test_logic_apps_deploy_workflow_artifacts(self, resource_group): response = await self.client.logic_apps.deploy_workflow_artifacts( resource_group_name=resource_group.name, container_app_name="str", logic_app_name="str", - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -114,12 +114,12 @@ async def test_deploy_workflow_artifacts(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_workflows_connections(self, resource_group): + async def test_logic_apps_list_workflows_connections(self, resource_group): response = await self.client.logic_apps.list_workflows_connections( resource_group_name=resource_group.name, container_app_name="str", logic_app_name="str", - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -127,14 +127,14 @@ async def test_list_workflows_connections(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_invoke(self, resource_group): + async def test_logic_apps_invoke(self, resource_group): response = await self.client.logic_apps.invoke( resource_group_name=resource_group.name, container_app_name="str", logic_app_name="str", x_ms_logic_apps_proxy_path="str", x_ms_logic_apps_proxy_method="str", - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_maintenance_configurations_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_maintenance_configurations_operations.py new file mode 100644 index 000000000000..37a584beb426 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_maintenance_configurations_operations.py @@ -0,0 +1,84 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIMaintenanceConfigurationsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_maintenance_configurations_list(self, resource_group): + response = self.client.maintenance_configurations.list( + resource_group_name=resource_group.name, + environment_name="str", + api_version="2025-02-02-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_maintenance_configurations_create_or_update(self, resource_group): + response = self.client.maintenance_configurations.create_or_update( + resource_group_name=resource_group.name, + environment_name="str", + config_name="str", + maintenance_configuration_envelope={ + "id": "str", + "name": "str", + "scheduledEntries": [{"durationHours": 0, "startHourUtc": 0, "weekDay": "str"}], + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2025-02-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_maintenance_configurations_delete(self, resource_group): + response = self.client.maintenance_configurations.delete( + resource_group_name=resource_group.name, + environment_name="str", + config_name="str", + api_version="2025-02-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_maintenance_configurations_get(self, resource_group): + response = self.client.maintenance_configurations.get( + resource_group_name=resource_group.name, + environment_name="str", + config_name="str", + api_version="2025-02-02-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_maintenance_configurations_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_maintenance_configurations_operations_async.py new file mode 100644 index 000000000000..870e664e4223 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_maintenance_configurations_operations_async.py @@ -0,0 +1,85 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIMaintenanceConfigurationsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_maintenance_configurations_list(self, resource_group): + response = self.client.maintenance_configurations.list( + resource_group_name=resource_group.name, + environment_name="str", + api_version="2025-02-02-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_maintenance_configurations_create_or_update(self, resource_group): + response = await self.client.maintenance_configurations.create_or_update( + resource_group_name=resource_group.name, + environment_name="str", + config_name="str", + maintenance_configuration_envelope={ + "id": "str", + "name": "str", + "scheduledEntries": [{"durationHours": 0, "startHourUtc": 0, "weekDay": "str"}], + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2025-02-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_maintenance_configurations_delete(self, resource_group): + response = await self.client.maintenance_configurations.delete( + resource_group_name=resource_group.name, + environment_name="str", + config_name="str", + api_version="2025-02-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_maintenance_configurations_get(self, resource_group): + response = await self.client.maintenance_configurations.get( + resource_group_name=resource_group.name, + environment_name="str", + config_name="str", + api_version="2025-02-02-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_certificates_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_certificates_operations.py index 838c10882e57..dcc23616e9cf 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_certificates_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_certificates_operations.py @@ -25,7 +25,7 @@ def test_managed_certificates_get(self, resource_group): resource_group_name=resource_group.name, environment_name="str", managed_certificate_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -38,7 +38,7 @@ def test_managed_certificates_begin_create_or_update(self, resource_group): resource_group_name=resource_group.name, environment_name="str", managed_certificate_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -51,7 +51,7 @@ def test_managed_certificates_delete(self, resource_group): resource_group_name=resource_group.name, environment_name="str", managed_certificate_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -65,7 +65,7 @@ def test_managed_certificates_update(self, resource_group): environment_name="str", managed_certificate_name="str", managed_certificate_envelope={"tags": {"str": "str"}}, - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -77,7 +77,7 @@ def test_managed_certificates_list(self, resource_group): response = self.client.managed_certificates.list( resource_group_name=resource_group.name, environment_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_certificates_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_certificates_operations_async.py index f1aec82b9e11..8f3f2bd22ad4 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_certificates_operations_async.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_certificates_operations_async.py @@ -26,7 +26,7 @@ async def test_managed_certificates_get(self, resource_group): resource_group_name=resource_group.name, environment_name="str", managed_certificate_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -40,7 +40,7 @@ async def test_managed_certificates_begin_create_or_update(self, resource_group) resource_group_name=resource_group.name, environment_name="str", managed_certificate_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) ).result() # call '.result()' to poll until service return final result @@ -54,7 +54,7 @@ async def test_managed_certificates_delete(self, resource_group): resource_group_name=resource_group.name, environment_name="str", managed_certificate_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -68,7 +68,7 @@ async def test_managed_certificates_update(self, resource_group): environment_name="str", managed_certificate_name="str", managed_certificate_envelope={"tags": {"str": "str"}}, - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -80,7 +80,7 @@ async def test_managed_certificates_list(self, resource_group): response = self.client.managed_certificates.list( resource_group_name=resource_group.name, environment_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_diagnostics_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_diagnostics_operations.py index 32c87961ef58..ca6101f73b67 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_diagnostics_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_diagnostics_operations.py @@ -24,7 +24,7 @@ def test_managed_environment_diagnostics_list_detectors(self, resource_group): response = self.client.managed_environment_diagnostics.list_detectors( resource_group_name=resource_group.name, environment_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -37,7 +37,7 @@ def test_managed_environment_diagnostics_get_detector(self, resource_group): resource_group_name=resource_group.name, environment_name="str", detector_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_diagnostics_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_diagnostics_operations_async.py index 233b55bc9b2d..f6fff69c4b77 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_diagnostics_operations_async.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_diagnostics_operations_async.py @@ -25,7 +25,7 @@ async def test_managed_environment_diagnostics_list_detectors(self, resource_gro response = await self.client.managed_environment_diagnostics.list_detectors( resource_group_name=resource_group.name, environment_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -38,7 +38,7 @@ async def test_managed_environment_diagnostics_get_detector(self, resource_group resource_group_name=resource_group.name, environment_name="str", detector_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_private_endpoint_connections_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_private_endpoint_connections_operations.py index 44b9aa6dbcc2..ad3b4f49d7ae 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_private_endpoint_connections_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_private_endpoint_connections_operations.py @@ -20,11 +20,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list(self, resource_group): + def test_managed_environment_private_endpoint_connections_list(self, resource_group): response = self.client.managed_environment_private_endpoint_connections.list( resource_group_name=resource_group.name, environment_name="str", - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -32,12 +32,12 @@ def test_list(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_managed_environment_private_endpoint_connections_get(self, resource_group): response = self.client.managed_environment_private_endpoint_connections.get( resource_group_name=resource_group.name, environment_name="str", private_endpoint_connection_name="str", - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -45,7 +45,7 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_create_or_update(self, resource_group): + def test_managed_environment_private_endpoint_connections_begin_create_or_update(self, resource_group): response = self.client.managed_environment_private_endpoint_connections.begin_create_or_update( resource_group_name=resource_group.name, environment_name="str", @@ -67,7 +67,7 @@ def test_begin_create_or_update(self, resource_group): }, "type": "str", }, - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -75,12 +75,12 @@ def test_begin_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_delete(self, resource_group): + def test_managed_environment_private_endpoint_connections_begin_delete(self, resource_group): response = self.client.managed_environment_private_endpoint_connections.begin_delete( resource_group_name=resource_group.name, environment_name="str", private_endpoint_connection_name="str", - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_private_endpoint_connections_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_private_endpoint_connections_operations_async.py index ea026b11caf3..53d86ddcc7f4 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_private_endpoint_connections_operations_async.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_private_endpoint_connections_operations_async.py @@ -21,11 +21,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list(self, resource_group): + async def test_managed_environment_private_endpoint_connections_list(self, resource_group): response = self.client.managed_environment_private_endpoint_connections.list( resource_group_name=resource_group.name, environment_name="str", - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -33,12 +33,12 @@ async def test_list(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_managed_environment_private_endpoint_connections_get(self, resource_group): response = await self.client.managed_environment_private_endpoint_connections.get( resource_group_name=resource_group.name, environment_name="str", private_endpoint_connection_name="str", - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -46,7 +46,7 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_create_or_update(self, resource_group): + async def test_managed_environment_private_endpoint_connections_begin_create_or_update(self, resource_group): response = await ( await self.client.managed_environment_private_endpoint_connections.begin_create_or_update( resource_group_name=resource_group.name, @@ -73,7 +73,7 @@ async def test_begin_create_or_update(self, resource_group): }, "type": "str", }, - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ) ).result() # call '.result()' to poll until service return final result @@ -82,13 +82,13 @@ async def test_begin_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_delete(self, resource_group): + async def test_managed_environment_private_endpoint_connections_begin_delete(self, resource_group): response = await ( await self.client.managed_environment_private_endpoint_connections.begin_delete( resource_group_name=resource_group.name, environment_name="str", private_endpoint_connection_name="str", - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ) ).result() # call '.result()' to poll until service return final result diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_private_link_resources_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_private_link_resources_operations.py index 297c7238aa80..dc1565faf80e 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_private_link_resources_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_private_link_resources_operations.py @@ -20,11 +20,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list(self, resource_group): + def test_managed_environment_private_link_resources_list(self, resource_group): response = self.client.managed_environment_private_link_resources.list( resource_group_name=resource_group.name, environment_name="str", - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_private_link_resources_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_private_link_resources_operations_async.py index 74a629c4ff43..673a980203a4 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_private_link_resources_operations_async.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_private_link_resources_operations_async.py @@ -21,11 +21,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list(self, resource_group): + async def test_managed_environment_private_link_resources_list(self, resource_group): response = self.client.managed_environment_private_link_resources.list( resource_group_name=resource_group.name, environment_name="str", - api_version="2024-08-02-preview", + api_version="2025-02-02-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_usages_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_usages_operations.py index da9554410ba0..55332c0caa58 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_usages_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_usages_operations.py @@ -24,7 +24,7 @@ def test_managed_environment_usages_list(self, resource_group): response = self.client.managed_environment_usages.list( resource_group_name=resource_group.name, environment_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_usages_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_usages_operations_async.py index b2128275576d..f4b8f951cb7b 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_usages_operations_async.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_usages_operations_async.py @@ -25,7 +25,7 @@ async def test_managed_environment_usages_list(self, resource_group): response = self.client.managed_environment_usages.list( resource_group_name=resource_group.name, environment_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_diagnostics_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_diagnostics_operations.py index 45f1167f0f83..36fd756459e4 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_diagnostics_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_diagnostics_operations.py @@ -24,7 +24,7 @@ def test_managed_environments_diagnostics_get_root(self, resource_group): response = self.client.managed_environments_diagnostics.get_root( resource_group_name=resource_group.name, environment_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_diagnostics_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_diagnostics_operations_async.py index 89accd86b443..6e18d3329379 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_diagnostics_operations_async.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_diagnostics_operations_async.py @@ -25,7 +25,7 @@ async def test_managed_environments_diagnostics_get_root(self, resource_group): response = await self.client.managed_environments_diagnostics.get_root( resource_group_name=resource_group.name, environment_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_operations.py index db1fbdaf7ba6..be08093abe7d 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_operations.py @@ -22,7 +22,7 @@ def setup_method(self, method): @recorded_by_proxy def test_managed_environments_list_by_subscription(self, resource_group): response = self.client.managed_environments.list_by_subscription( - api_version="2025-01-01", + api_version="2025-02-02-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -33,7 +33,7 @@ def test_managed_environments_list_by_subscription(self, resource_group): def test_managed_environments_list_by_resource_group(self, resource_group): response = self.client.managed_environments.list_by_resource_group( resource_group_name=resource_group.name, - api_version="2025-01-01", + api_version="2025-02-02-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -45,7 +45,7 @@ def test_managed_environments_get(self, resource_group): response = self.client.managed_environments.get( resource_group_name=resource_group.name, environment_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -59,10 +59,12 @@ def test_managed_environments_begin_create_or_update(self, resource_group): environment_name="str", environment_envelope={ "location": "str", + "appInsightsConfiguration": {"connectionString": "str"}, "appLogsConfiguration": { "destination": "str", - "logAnalyticsConfiguration": {"customerId": "str", "sharedKey": "str"}, + "logAnalyticsConfiguration": {"customerId": "str", "dynamicJsonColumns": bool, "sharedKey": "str"}, }, + "availabilityZones": ["str"], "customDomainConfiguration": { "certificateKeyVaultProperties": {"identity": "str", "keyVaultUrl": "str"}, "certificatePassword": "str", @@ -87,12 +89,60 @@ def test_managed_environments_begin_create_or_update(self, resource_group): "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, }, "infrastructureResourceGroup": "str", + "ingressConfiguration": { + "headerCountLimit": 0, + "requestIdleTimeout": 0, + "scale": {"maxReplicas": 0, "minReplicas": 0}, + "terminationGracePeriodSeconds": 0, + "workloadProfileName": "str", + }, "kedaConfiguration": {"version": "str"}, "kind": "str", "name": "str", + "openTelemetryConfiguration": { + "destinationsConfiguration": { + "dataDogConfiguration": {"key": "str", "site": "str"}, + "otlpConfigurations": [ + { + "endpoint": "str", + "headers": [{"key": "str", "value": "str"}], + "insecure": bool, + "name": "str", + } + ], + }, + "logsConfiguration": {"destinations": ["str"]}, + "metricsConfiguration": {"destinations": ["str"], "includeKeda": bool}, + "tracesConfiguration": {"destinations": ["str"], "includeDapr": bool}, + }, "peerAuthentication": {"mtls": {"enabled": bool}}, "peerTrafficConfiguration": {"encryption": {"enabled": bool}}, + "privateEndpointConnections": [ + { + "groupIds": ["str"], + "id": "str", + "name": "str", + "privateEndpoint": {"id": "str"}, + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + } + ], + "privateLinkDefaultDomain": "str", "provisioningState": "str", + "publicNetworkAccess": "str", "staticIp": "str", "systemData": { "createdAt": "2020-02-20 00:00:00", @@ -112,11 +162,17 @@ def test_managed_environments_begin_create_or_update(self, resource_group): "platformReservedDnsIP": "str", }, "workloadProfiles": [ - {"name": "str", "workloadProfileType": "str", "maximumCount": 0, "minimumCount": 0} + { + "name": "str", + "workloadProfileType": "str", + "enableFips": False, + "maximumCount": 0, + "minimumCount": 0, + } ], "zoneRedundant": bool, }, - api_version="2025-01-01", + api_version="2025-02-02-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -128,7 +184,7 @@ def test_managed_environments_begin_delete(self, resource_group): response = self.client.managed_environments.begin_delete( resource_group_name=resource_group.name, environment_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -142,10 +198,12 @@ def test_managed_environments_begin_update(self, resource_group): environment_name="str", environment_envelope={ "location": "str", + "appInsightsConfiguration": {"connectionString": "str"}, "appLogsConfiguration": { "destination": "str", - "logAnalyticsConfiguration": {"customerId": "str", "sharedKey": "str"}, + "logAnalyticsConfiguration": {"customerId": "str", "dynamicJsonColumns": bool, "sharedKey": "str"}, }, + "availabilityZones": ["str"], "customDomainConfiguration": { "certificateKeyVaultProperties": {"identity": "str", "keyVaultUrl": "str"}, "certificatePassword": "str", @@ -170,12 +228,60 @@ def test_managed_environments_begin_update(self, resource_group): "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, }, "infrastructureResourceGroup": "str", + "ingressConfiguration": { + "headerCountLimit": 0, + "requestIdleTimeout": 0, + "scale": {"maxReplicas": 0, "minReplicas": 0}, + "terminationGracePeriodSeconds": 0, + "workloadProfileName": "str", + }, "kedaConfiguration": {"version": "str"}, "kind": "str", "name": "str", + "openTelemetryConfiguration": { + "destinationsConfiguration": { + "dataDogConfiguration": {"key": "str", "site": "str"}, + "otlpConfigurations": [ + { + "endpoint": "str", + "headers": [{"key": "str", "value": "str"}], + "insecure": bool, + "name": "str", + } + ], + }, + "logsConfiguration": {"destinations": ["str"]}, + "metricsConfiguration": {"destinations": ["str"], "includeKeda": bool}, + "tracesConfiguration": {"destinations": ["str"], "includeDapr": bool}, + }, "peerAuthentication": {"mtls": {"enabled": bool}}, "peerTrafficConfiguration": {"encryption": {"enabled": bool}}, + "privateEndpointConnections": [ + { + "groupIds": ["str"], + "id": "str", + "name": "str", + "privateEndpoint": {"id": "str"}, + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + } + ], + "privateLinkDefaultDomain": "str", "provisioningState": "str", + "publicNetworkAccess": "str", "staticIp": "str", "systemData": { "createdAt": "2020-02-20 00:00:00", @@ -195,11 +301,17 @@ def test_managed_environments_begin_update(self, resource_group): "platformReservedDnsIP": "str", }, "workloadProfiles": [ - {"name": "str", "workloadProfileType": "str", "maximumCount": 0, "minimumCount": 0} + { + "name": "str", + "workloadProfileType": "str", + "enableFips": False, + "maximumCount": 0, + "minimumCount": 0, + } ], "zoneRedundant": bool, }, - api_version="2025-01-01", + api_version="2025-02-02-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -211,7 +323,7 @@ def test_managed_environments_get_auth_token(self, resource_group): response = self.client.managed_environments.get_auth_token( resource_group_name=resource_group.name, environment_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -223,7 +335,7 @@ def test_managed_environments_list_workload_profile_states(self, resource_group) response = self.client.managed_environments.list_workload_profile_states( resource_group_name=resource_group.name, environment_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_operations_async.py index 46a3fd08b1f0..6488172d1d4d 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_operations_async.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_operations_async.py @@ -23,7 +23,7 @@ def setup_method(self, method): @recorded_by_proxy_async async def test_managed_environments_list_by_subscription(self, resource_group): response = self.client.managed_environments.list_by_subscription( - api_version="2025-01-01", + api_version="2025-02-02-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -34,7 +34,7 @@ async def test_managed_environments_list_by_subscription(self, resource_group): async def test_managed_environments_list_by_resource_group(self, resource_group): response = self.client.managed_environments.list_by_resource_group( resource_group_name=resource_group.name, - api_version="2025-01-01", + api_version="2025-02-02-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -46,7 +46,7 @@ async def test_managed_environments_get(self, resource_group): response = await self.client.managed_environments.get( resource_group_name=resource_group.name, environment_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -61,10 +61,16 @@ async def test_managed_environments_begin_create_or_update(self, resource_group) environment_name="str", environment_envelope={ "location": "str", + "appInsightsConfiguration": {"connectionString": "str"}, "appLogsConfiguration": { "destination": "str", - "logAnalyticsConfiguration": {"customerId": "str", "sharedKey": "str"}, + "logAnalyticsConfiguration": { + "customerId": "str", + "dynamicJsonColumns": bool, + "sharedKey": "str", + }, }, + "availabilityZones": ["str"], "customDomainConfiguration": { "certificateKeyVaultProperties": {"identity": "str", "keyVaultUrl": "str"}, "certificatePassword": "str", @@ -89,12 +95,60 @@ async def test_managed_environments_begin_create_or_update(self, resource_group) "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, }, "infrastructureResourceGroup": "str", + "ingressConfiguration": { + "headerCountLimit": 0, + "requestIdleTimeout": 0, + "scale": {"maxReplicas": 0, "minReplicas": 0}, + "terminationGracePeriodSeconds": 0, + "workloadProfileName": "str", + }, "kedaConfiguration": {"version": "str"}, "kind": "str", "name": "str", + "openTelemetryConfiguration": { + "destinationsConfiguration": { + "dataDogConfiguration": {"key": "str", "site": "str"}, + "otlpConfigurations": [ + { + "endpoint": "str", + "headers": [{"key": "str", "value": "str"}], + "insecure": bool, + "name": "str", + } + ], + }, + "logsConfiguration": {"destinations": ["str"]}, + "metricsConfiguration": {"destinations": ["str"], "includeKeda": bool}, + "tracesConfiguration": {"destinations": ["str"], "includeDapr": bool}, + }, "peerAuthentication": {"mtls": {"enabled": bool}}, "peerTrafficConfiguration": {"encryption": {"enabled": bool}}, + "privateEndpointConnections": [ + { + "groupIds": ["str"], + "id": "str", + "name": "str", + "privateEndpoint": {"id": "str"}, + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + } + ], + "privateLinkDefaultDomain": "str", "provisioningState": "str", + "publicNetworkAccess": "str", "staticIp": "str", "systemData": { "createdAt": "2020-02-20 00:00:00", @@ -114,11 +168,17 @@ async def test_managed_environments_begin_create_or_update(self, resource_group) "platformReservedDnsIP": "str", }, "workloadProfiles": [ - {"name": "str", "workloadProfileType": "str", "maximumCount": 0, "minimumCount": 0} + { + "name": "str", + "workloadProfileType": "str", + "enableFips": False, + "maximumCount": 0, + "minimumCount": 0, + } ], "zoneRedundant": bool, }, - api_version="2025-01-01", + api_version="2025-02-02-preview", ) ).result() # call '.result()' to poll until service return final result @@ -132,7 +192,7 @@ async def test_managed_environments_begin_delete(self, resource_group): await self.client.managed_environments.begin_delete( resource_group_name=resource_group.name, environment_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) ).result() # call '.result()' to poll until service return final result @@ -148,10 +208,16 @@ async def test_managed_environments_begin_update(self, resource_group): environment_name="str", environment_envelope={ "location": "str", + "appInsightsConfiguration": {"connectionString": "str"}, "appLogsConfiguration": { "destination": "str", - "logAnalyticsConfiguration": {"customerId": "str", "sharedKey": "str"}, + "logAnalyticsConfiguration": { + "customerId": "str", + "dynamicJsonColumns": bool, + "sharedKey": "str", + }, }, + "availabilityZones": ["str"], "customDomainConfiguration": { "certificateKeyVaultProperties": {"identity": "str", "keyVaultUrl": "str"}, "certificatePassword": "str", @@ -176,12 +242,60 @@ async def test_managed_environments_begin_update(self, resource_group): "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, }, "infrastructureResourceGroup": "str", + "ingressConfiguration": { + "headerCountLimit": 0, + "requestIdleTimeout": 0, + "scale": {"maxReplicas": 0, "minReplicas": 0}, + "terminationGracePeriodSeconds": 0, + "workloadProfileName": "str", + }, "kedaConfiguration": {"version": "str"}, "kind": "str", "name": "str", + "openTelemetryConfiguration": { + "destinationsConfiguration": { + "dataDogConfiguration": {"key": "str", "site": "str"}, + "otlpConfigurations": [ + { + "endpoint": "str", + "headers": [{"key": "str", "value": "str"}], + "insecure": bool, + "name": "str", + } + ], + }, + "logsConfiguration": {"destinations": ["str"]}, + "metricsConfiguration": {"destinations": ["str"], "includeKeda": bool}, + "tracesConfiguration": {"destinations": ["str"], "includeDapr": bool}, + }, "peerAuthentication": {"mtls": {"enabled": bool}}, "peerTrafficConfiguration": {"encryption": {"enabled": bool}}, + "privateEndpointConnections": [ + { + "groupIds": ["str"], + "id": "str", + "name": "str", + "privateEndpoint": {"id": "str"}, + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + } + ], + "privateLinkDefaultDomain": "str", "provisioningState": "str", + "publicNetworkAccess": "str", "staticIp": "str", "systemData": { "createdAt": "2020-02-20 00:00:00", @@ -201,11 +315,17 @@ async def test_managed_environments_begin_update(self, resource_group): "platformReservedDnsIP": "str", }, "workloadProfiles": [ - {"name": "str", "workloadProfileType": "str", "maximumCount": 0, "minimumCount": 0} + { + "name": "str", + "workloadProfileType": "str", + "enableFips": False, + "maximumCount": 0, + "minimumCount": 0, + } ], "zoneRedundant": bool, }, - api_version="2025-01-01", + api_version="2025-02-02-preview", ) ).result() # call '.result()' to poll until service return final result @@ -218,7 +338,7 @@ async def test_managed_environments_get_auth_token(self, resource_group): response = await self.client.managed_environments.get_auth_token( resource_group_name=resource_group.name, environment_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -230,7 +350,7 @@ async def test_managed_environments_list_workload_profile_states(self, resource_ response = self.client.managed_environments.list_workload_profile_states( resource_group_name=resource_group.name, environment_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_storages_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_storages_operations.py index 0302756118e0..8b6d332d8fc3 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_storages_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_storages_operations.py @@ -24,7 +24,7 @@ def test_managed_environments_storages_list(self, resource_group): response = self.client.managed_environments_storages.list( resource_group_name=resource_group.name, environment_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -37,7 +37,7 @@ def test_managed_environments_storages_get(self, resource_group): resource_group_name=resource_group.name, environment_name="str", storage_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -54,7 +54,13 @@ def test_managed_environments_storages_create_or_update(self, resource_group): "id": "str", "name": "str", "properties": { - "azureFile": {"accessMode": "str", "accountKey": "str", "accountName": "str", "shareName": "str"}, + "azureFile": { + "accessMode": "str", + "accountKey": "str", + "accountKeyVaultProperties": {"identity": "str", "keyVaultUrl": "str"}, + "accountName": "str", + "shareName": "str", + }, "nfsAzureFile": {"accessMode": "str", "server": "str", "shareName": "str"}, }, "systemData": { @@ -67,7 +73,7 @@ def test_managed_environments_storages_create_or_update(self, resource_group): }, "type": "str", }, - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -80,7 +86,7 @@ def test_managed_environments_storages_delete(self, resource_group): resource_group_name=resource_group.name, environment_name="str", storage_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_storages_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_storages_operations_async.py index 052368ca0c16..cd9c72c1e9f4 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_storages_operations_async.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_storages_operations_async.py @@ -25,7 +25,7 @@ async def test_managed_environments_storages_list(self, resource_group): response = await self.client.managed_environments_storages.list( resource_group_name=resource_group.name, environment_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -38,7 +38,7 @@ async def test_managed_environments_storages_get(self, resource_group): resource_group_name=resource_group.name, environment_name="str", storage_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -55,7 +55,13 @@ async def test_managed_environments_storages_create_or_update(self, resource_gro "id": "str", "name": "str", "properties": { - "azureFile": {"accessMode": "str", "accountKey": "str", "accountName": "str", "shareName": "str"}, + "azureFile": { + "accessMode": "str", + "accountKey": "str", + "accountKeyVaultProperties": {"identity": "str", "keyVaultUrl": "str"}, + "accountName": "str", + "shareName": "str", + }, "nfsAzureFile": {"accessMode": "str", "server": "str", "shareName": "str"}, }, "systemData": { @@ -68,7 +74,7 @@ async def test_managed_environments_storages_create_or_update(self, resource_gro }, "type": "str", }, - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself @@ -81,7 +87,7 @@ async def test_managed_environments_storages_delete(self, resource_group): resource_group_name=resource_group.name, environment_name="str", storage_name="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_namespaces_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_namespaces_operations.py index 962229ae1783..786e43f4553c 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_namespaces_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_namespaces_operations.py @@ -25,7 +25,7 @@ def test_namespaces_check_name_availability(self, resource_group): resource_group_name=resource_group.name, environment_name="str", check_name_availability_request={"name": "str", "type": "str"}, - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_namespaces_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_namespaces_operations_async.py index 9324213427b4..42c9399d0144 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_namespaces_operations_async.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_namespaces_operations_async.py @@ -26,7 +26,7 @@ async def test_namespaces_check_name_availability(self, resource_group): resource_group_name=resource_group.name, environment_name="str", check_name_availability_request={"name": "str", "type": "str"}, - api_version="2025-01-01", + api_version="2025-02-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_operations.py index d5e6e83a4963..73535a565377 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_operations.py @@ -22,7 +22,7 @@ def setup_method(self, method): @recorded_by_proxy def test_operations_list(self, resource_group): response = self.client.operations.list( - api_version="2025-01-01", + api_version="2025-02-02-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_operations_async.py index 2dfb01d4073d..383c0df36abf 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_operations_async.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_operations_async.py @@ -23,7 +23,7 @@ def setup_method(self, method): @recorded_by_proxy_async async def test_operations_list(self, resource_group): response = self.client.operations.list( - api_version="2025-01-01", + api_version="2025-02-02-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_usages_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_usages_operations.py index 041661a85d28..f9c17ac44750 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_usages_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_usages_operations.py @@ -23,7 +23,7 @@ def setup_method(self, method): def test_usages_list(self, resource_group): response = self.client.usages.list( location="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_usages_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_usages_operations_async.py index 27a750bc17e6..dcca0b95f7ed 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_usages_operations_async.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_usages_operations_async.py @@ -24,7 +24,7 @@ def setup_method(self, method): async def test_usages_list(self, resource_group): response = self.client.usages.list( location="str", - api_version="2025-01-01", + api_version="2025-02-02-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/sdk_packaging.toml b/sdk/appcontainers/azure-mgmt-appcontainers/sdk_packaging.toml index f16da3032654..9b9e139e8165 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/sdk_packaging.toml +++ b/sdk/appcontainers/azure-mgmt-appcontainers/sdk_packaging.toml @@ -3,7 +3,7 @@ package_name = "azure-mgmt-appcontainers" package_nspkg = "azure-mgmt-nspkg" package_pprint_name = "Appcontainers Management" package_doc_id = "" -is_stable = true +is_stable = false is_arm = true need_msrestazure = false need_azuremgmtcore = true diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/setup.py b/sdk/appcontainers/azure-mgmt-appcontainers/setup.py index 5a173047c272..505a0e3d4801 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/setup.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/setup.py @@ -49,11 +49,10 @@ url="https://github.com/Azure/azure-sdk-for-python", keywords="azure, azure sdk", # update with search keywords relevant to the azure service / product classifiers=[ - "Development Status :: 5 - Production/Stable", + "Development Status :: 4 - Beta", "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", @@ -77,7 +76,7 @@ "isodate>=0.6.1", "typing-extensions>=4.6.0", "azure-common>=1.1", - "azure-mgmt-core>=1.3.2", + "azure-mgmt-core>=1.5.0", ], - python_requires=">=3.8", + python_requires=">=3.9", )