From d9ceb5ebe9514365791adddad26471155cc105b3 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Thu, 26 Sep 2024 14:35:53 +0000 Subject: [PATCH] CodeGen from PR 30748 in Azure/azure-rest-api-specs Merge f661d35899761e877eb5aa2797c7d2e8a23e6dff into 1dc7b2340566bab01000efb33b0e6894f75d49ed --- .../azure-mgmt-appcontainers/_meta.json | 6 +- .../mgmt/appcontainers/_configuration.py | 8 +- .../_container_apps_api_client.py | 111 +- .../azure/mgmt/appcontainers/_version.py | 2 +- .../mgmt/appcontainers/aio/_configuration.py | 8 +- .../aio/_container_apps_api_client.py | 113 +- .../appcontainers/aio/operations/__init__.py | 36 + .../operations/_app_resiliency_operations.py | 562 + ..._available_workload_profiles_operations.py | 1 - .../operations/_billing_meters_operations.py | 1 - .../_build_auth_token_operations.py | 115 + .../aio/operations/_builders_operations.py | 792 ++ .../_builds_by_builder_resource_operations.py | 140 + .../aio/operations/_builds_operations.py | 450 + .../operations/_certificates_operations.py | 1 - ...ed_environments_certificates_operations.py | 1 - ...environments_dapr_components_operations.py | 1 - .../_connected_environments_operations.py | 1 - ...nected_environments_storages_operations.py | 1 - ..._container_apps_auth_configs_operations.py | 1 - ...apps_builds_by_container_app_operations.py | 142 + .../_container_apps_builds_operations.py | 235 + .../_container_apps_diagnostics_operations.py | 1 - .../operations/_container_apps_operations.py | 1 - .../_container_apps_patches_operations.py | 664 ++ ...ainer_apps_revision_replicas_operations.py | 1 - .../_container_apps_revisions_operations.py | 1 - ...container_apps_session_pools_operations.py | 808 ++ ...ntainer_apps_source_controls_operations.py | 48 +- ...omponent_resiliency_policies_operations.py | 444 + .../operations/_dapr_components_operations.py | 1 - .../_dapr_subscriptions_operations.py | 420 + .../_dot_net_components_operations.py | 765 ++ .../_functions_extension_operations.py | 125 + .../operations/_java_components_operations.py | 764 ++ .../operations/_jobs_executions_operations.py | 1 - .../aio/operations/_jobs_operations.py | 245 +- .../aio/operations/_logic_apps_operations.py | 767 ++ .../_managed_certificates_operations.py | 1 - ...aged_environment_diagnostics_operations.py | 1 - ...private_endpoint_connections_operations.py | 557 + ...nment_private_link_resources_operations.py | 143 + .../_managed_environment_usages_operations.py | 1 - ...ged_environments_diagnostics_operations.py | 1 - .../_managed_environments_operations.py | 1 - ...anaged_environments_storages_operations.py | 1 - .../aio/operations/_namespaces_operations.py | 1 - .../aio/operations/_operations.py | 1 - .../aio/operations/_usages_operations.py | 1 - .../mgmt/appcontainers/models/__init__.py | 278 + .../_container_apps_api_client_enums.py | 269 + .../mgmt/appcontainers/models/_models_py3.py | 9253 +++++++++++++---- .../mgmt/appcontainers/operations/__init__.py | 36 + .../operations/_app_resiliency_operations.py | 731 ++ ..._available_workload_profiles_operations.py | 5 +- .../operations/_billing_meters_operations.py | 5 +- .../_build_auth_token_operations.py | 154 + .../operations/_builders_operations.py | 980 ++ .../_builds_by_builder_resource_operations.py | 174 + .../operations/_builds_operations.py | 567 + .../operations/_certificates_operations.py | 21 +- ...ed_environments_certificates_operations.py | 21 +- ...environments_dapr_components_operations.py | 21 +- .../_connected_environments_operations.py | 29 +- ...nected_environments_storages_operations.py | 17 +- .../_container_apps_api_client_operations.py | 8 +- ..._container_apps_auth_configs_operations.py | 17 +- ...apps_builds_by_container_app_operations.py | 180 + .../_container_apps_builds_operations.py | 314 + .../_container_apps_diagnostics_operations.py | 21 +- .../operations/_container_apps_operations.py | 45 +- .../_container_apps_patches_operations.py | 856 ++ ...ainer_apps_revision_replicas_operations.py | 9 +- .../_container_apps_revisions_operations.py | 21 +- ...container_apps_session_pools_operations.py | 997 ++ ...ntainer_apps_source_controls_operations.py | 92 +- ...omponent_resiliency_policies_operations.py | 583 ++ .../operations/_dapr_components_operations.py | 21 +- .../_dapr_subscriptions_operations.py | 554 + .../_dot_net_components_operations.py | 932 ++ .../_functions_extension_operations.py | 170 + .../operations/_java_components_operations.py | 930 ++ .../operations/_jobs_executions_operations.py | 5 +- .../operations/_jobs_operations.py | 349 +- .../operations/_logic_apps_operations.py | 1074 ++ .../_managed_certificates_operations.py | 21 +- ...aged_environment_diagnostics_operations.py | 9 +- ...private_endpoint_connections_operations.py | 710 ++ ...nment_private_link_resources_operations.py | 178 + .../_managed_environment_usages_operations.py | 5 +- ...ged_environments_diagnostics_operations.py | 5 +- .../_managed_environments_operations.py | 33 +- ...anaged_environments_storages_operations.py | 17 +- .../operations/_namespaces_operations.py | 5 +- .../appcontainers/operations/_operations.py | 3 +- .../operations/_usages_operations.py | 5 +- .../app_resiliency_create_or_update.py | 61 + .../app_resiliency_delete.py | 42 + .../generated_samples/app_resiliency_get.py | 43 + .../generated_samples/app_resiliency_list.py | 43 + .../generated_samples/app_resiliency_patch.py | 46 + .../auth_configs_create_or_update.py | 4 +- .../generated_samples/auth_configs_delete.py | 2 +- .../generated_samples/auth_configs_get.py | 2 +- .../auth_configs_list_by_container.py | 2 +- .../available_workload_profiles_get.py | 2 +- .../generated_samples/billing_meters_get.py | 2 +- .../builders_create_or_update.py | 65 + .../generated_samples/builders_delete.py | 41 + .../generated_samples/builders_get.py | 42 + .../builders_list_by_resource_group.py | 42 + .../builders_list_by_subscription.py | 40 + .../generated_samples/builders_update.py | 43 + .../builds_create_or_update.py | 70 + .../generated_samples/builds_delete.py | 42 + .../generated_samples/builds_get.py | 43 + .../builds_list_auth_token.py | 43 + .../builds_list_by_builder_resource.py | 43 + .../certificate_create_or_update.py | 2 +- ...ificate_create_or_update_from_key_vault.py | 43 + .../generated_samples/certificate_delete.py | 2 +- .../generated_samples/certificate_get.py | 2 +- .../certificates_check_name_availability.py | 4 +- ...ertificates_list_by_managed_environment.py | 2 +- .../generated_samples/certificates_patch.py | 4 +- ...vironments_certificate_create_or_update.py | 2 +- ...nnected_environments_certificate_delete.py | 2 +- .../connected_environments_certificate_get.py | 2 +- ...ts_certificates_check_name_availability.py | 4 +- ...tificates_list_by_connected_environment.py | 2 +- ...nnected_environments_certificates_patch.py | 4 +- ...connected_environments_create_or_update.py | 4 +- ...nments_dapr_components_create_or_update.py | 11 +- ...ted_environments_dapr_components_delete.py | 2 +- ...nected_environments_dapr_components_get.py | 2 +- ...ected_environments_dapr_components_list.py | 2 +- ...vironments_dapr_components_list_secrets.py | 2 +- .../connected_environments_delete.py | 2 +- .../connected_environments_get.py | 2 +- ...ted_environments_list_by_resource_group.py | 2 +- ...ected_environments_list_by_subscription.py | 2 +- .../connected_environments_patch.py | 2 +- ..._environments_storages_create_or_update.py | 4 +- .../connected_environments_storages_delete.py | 2 +- .../connected_environments_storages_get.py | 2 +- .../connected_environments_storages_list.py | 2 +- .../container_apps_builds_delete.py | 42 + .../container_apps_builds_get.py | 43 + ...ainer_apps_builds_list_by_container_app.py | 43 + .../container_apps_check_name_availability.py | 4 +- .../container_apps_create_or_update.py | 76 +- ..._create_or_update_connected_environment.py | 162 + .../container_apps_delete.py | 4 +- .../container_apps_diagnostics_get.py | 2 +- .../container_apps_diagnostics_list.py | 2 +- .../generated_samples/container_apps_get.py | 4 +- .../container_apps_get_auth_token.py | 4 +- .../container_apps_kind_create_or_update.py | 64 + .../container_apps_list_by_resource_group.py | 2 +- .../container_apps_list_by_subscription.py | 2 +- ...ner_apps_list_custom_host_name_analysis.py | 4 +- .../container_apps_list_secrets.py | 4 +- ...tainer_apps_managed_by_create_or_update.py | 14 +- .../generated_samples/container_apps_patch.py | 32 +- .../container_apps_patches_apply.py | 43 + .../container_apps_patches_delete.py | 42 + .../container_apps_patches_get.py | 43 + ...iner_apps_patches_list_by_container_app.py | 43 + .../container_apps_patches_skip_configure.py | 43 + ...ps_source_to_cloud_app_create_or_update.py | 166 + .../generated_samples/container_apps_start.py | 4 +- .../generated_samples/container_apps_stop.py | 4 +- ...container_apps_tcp_app_create_or_update.py | 14 +- ...pr_component_resiliency_policies_delete.py | 43 + .../dapr_component_resiliency_policies_get.py | 44 + ...dapr_component_resiliency_policies_list.py | 44 + ...ncy_policy_create_or_update_all_options.py | 64 + ...y_policy_create_or_update_outbound_only.py | 56 + ..._policy_create_or_update_sparse_options.py | 56 + ...create_or_update_secret_store_component.py | 11 +- ...apr_components_create_or_update_secrets.py | 11 +- .../dapr_components_delete.py | 2 +- ...r_components_get_secret_store_component.py | 2 +- .../dapr_components_get_secrets.py | 2 +- .../generated_samples/dapr_components_list.py | 2 +- .../dapr_components_list_secrets.py | 2 +- ...ate_or_update_bulk_subscribe_and_scopes.py | 52 + ...riptions_create_or_update_default_route.py | 46 + ...eate_or_update_route_rules_and_metadata.py | 57 + .../dapr_subscriptions_delete.py | 42 + ...criptions_get_bulk_subscribe_and_scopes.py | 43 + .../dapr_subscriptions_get_default_route.py | 43 + ...scriptions_get_route_rules_and_metadata.py | 43 + .../dapr_subscriptions_list.py | 43 + .../dot_net_components_create_or_update.py | 49 + ...omponents_create_or_update_service_bind.py | 55 + .../dot_net_components_delete.py | 42 + .../dot_net_components_get.py | 43 + .../dot_net_components_get_service_bind.py | 43 + .../dot_net_components_list.py | 43 + .../dot_net_components_list_service_bind.py | 43 + .../dot_net_components_patch.py | 49 + .../dot_net_components_patch_service_bind.py | 55 + .../functions_extension_post.py | 44 + .../java_components_create_or_update.py | 53 + ...omponents_create_or_update_service_bind.py | 59 + .../java_components_delete.py | 42 + .../generated_samples/java_components_get.py | 43 + .../java_components_get_service_bind.py | 43 + .../generated_samples/java_components_list.py | 43 + .../java_components_list_service_bind.py | 43 + .../java_components_patch.py | 53 + .../java_components_patch_service_bind.py | 59 + .../generated_samples/job_createor_update.py | 85 - .../generated_samples/job_delete.py | 4 +- .../generated_samples/job_execution_get.py | 4 +- .../generated_samples/job_executions_get.py | 4 +- .../generated_samples/job_get.py | 4 +- .../generated_samples/job_get_detector.py | 2 +- .../generated_samples/job_list_detectors.py | 2 +- .../generated_samples/job_list_secrets.py | 4 +- .../generated_samples/job_proxy_get.py | 4 +- .../generated_samples/job_start.py | 4 +- .../generated_samples/job_stop_execution.py | 4 +- .../generated_samples/job_stop_multiple.py | 4 +- .../jobs_list_by_resource_group.py | 2 +- .../jobs_list_by_subscription.py | 2 +- .../generated_samples/jobs_resume.py | 42 + .../generated_samples/jobs_suspend.py | 42 + .../generated_samples/logic_apps_create.py | 44 + .../generated_samples/logic_apps_delete.py | 42 + ...c_apps_delete_deploy_workflow_artifacts.py | 42 + .../generated_samples/logic_apps_get.py | 43 + .../logic_apps_get_workflow.py | 44 + .../logic_apps_list_connections.py | 43 + .../logic_apps_list_workflows.py | 44 + ...gic_apps_post_deploy_workflow_artifacts.py | 42 + .../managed_certificate_create_or_update.py | 2 +- .../managed_certificate_delete.py | 2 +- .../managed_certificate_get.py | 2 +- ...ertificates_list_by_managed_environment.py | 2 +- .../managed_certificates_patch.py | 4 +- .../managed_environment_diagnostics_get.py | 2 +- .../managed_environment_diagnostics_list.py | 2 +- ...e_endpoint_connections_create_or_update.py | 46 + ...ent_private_endpoint_connections_delete.py | 42 + ...onment_private_endpoint_connections_get.py | 43 + ...nment_private_endpoint_connections_list.py | 43 + ...environment_private_link_resources_list.py | 43 + .../managed_environment_usages_list.py | 2 +- .../managed_environments_create_or_update.py | 38 +- ...om_infrastructure_resource_group_create.py | 5 +- .../managed_environments_delete.py | 2 +- .../managed_environments_get.py | 2 +- .../managed_environments_get_auth_token.py | 2 +- ...ged_environments_list_by_resource_group.py | 2 +- ...naged_environments_list_by_subscription.py | 2 +- ...vironments_list_workload_profile_states.py | 2 +- .../managed_environments_patch.py | 4 +- ..._environments_storages_create_or_update.py | 4 +- ...torages_create_or_update_nfs_azure_file.py | 46 + .../managed_environments_storages_delete.py | 2 +- .../managed_environments_storages_get.py | 2 +- ...nvironments_storages_get_nfs_azure_file.py | 43 + .../managed_environments_storages_list.py | 2 +- .../generated_samples/operations_list.py | 2 +- .../generated_samples/replicas_get.py | 2 +- .../generated_samples/replicas_list.py | 2 +- .../generated_samples/revisions_activate.py | 2 +- .../generated_samples/revisions_deactivate.py | 2 +- .../generated_samples/revisions_get.py | 2 +- .../generated_samples/revisions_list.py | 2 +- .../generated_samples/revisions_restart.py | 2 +- ...r.py => session_pools_create_or_update.py} | 52 +- .../generated_samples/session_pools_delete.py | 41 + .../generated_samples/session_pools_get.py | 42 + .../session_pools_list_by_resource_group.py | 42 + .../session_pools_list_by_subscription.py | 40 + .../{job_patch.py => session_pools_patch.py} | 48 +- .../source_controls_create_or_update.py | 6 +- .../source_controls_delete.py | 2 +- .../generated_samples/source_controls_get.py | 2 +- .../source_controls_list_by_container.py | 2 +- ...tions_get_custom_domain_verification_id.py | 2 +- .../generated_samples/usages_list.py | 2 +- .../test_container_apps_api.py | 4 +- ...iner_apps_api_app_resiliency_operations.py | 151 + ...pps_api_app_resiliency_operations_async.py | 152 + .../test_container_apps_api_async.py | 4 +- ..._available_workload_profiles_operations.py | 2 +- ...able_workload_profiles_operations_async.py | 2 +- ...iner_apps_api_billing_meters_operations.py | 2 +- ...pps_api_billing_meters_operations_async.py | 2 +- ...er_apps_api_build_auth_token_operations.py | 32 + ...s_api_build_auth_token_operations_async.py | 33 + ..._container_apps_api_builders_operations.py | 122 + ...iner_apps_api_builders_operations_async.py | 129 + ...i_builds_by_builder_resource_operations.py | 31 + ...ds_by_builder_resource_operations_async.py | 32 + ...st_container_apps_api_builds_operations.py | 90 + ...tainer_apps_api_builds_operations_async.py | 95 + ...tainer_apps_api_certificates_operations.py | 10 +- ..._apps_api_certificates_operations_async.py | 10 +- ...ed_environments_certificates_operations.py | 10 +- ...ironments_certificates_operations_async.py | 10 +- ...environments_dapr_components_operations.py | 13 +- ...nments_dapr_components_operations_async.py | 13 +- ...s_api_connected_environments_operations.py | 15 +- ...connected_environments_operations_async.py | 15 +- ...nected_environments_storages_operations.py | 18 +- ..._environments_storages_operations_async.py | 18 +- ..._container_apps_auth_configs_operations.py | 8 +- ...iner_apps_auth_configs_operations_async.py | 8 +- ...apps_builds_by_container_app_operations.py | 31 + ...uilds_by_container_app_operations_async.py | 32 + ...ps_api_container_apps_builds_operations.py | 45 + ..._container_apps_builds_operations_async.py | 48 + ...i_container_apps_diagnostics_operations.py | 10 +- ...ainer_apps_diagnostics_operations_async.py | 10 +- ...iner_apps_api_container_apps_operations.py | 78 +- ...pps_api_container_apps_operations_async.py | 78 +- ...s_api_container_apps_patches_operations.py | 84 + ...container_apps_patches_operations_async.py | 91 + ...ainer_apps_revision_replicas_operations.py | 4 +- ...apps_revision_replicas_operations_async.py | 4 +- ...api_container_apps_revisions_operations.py | 10 +- ...ntainer_apps_revisions_operations_async.py | 10 +- ...container_apps_session_pools_operations.py | 157 + ...ner_apps_session_pools_operations_async.py | 164 + ...ntainer_apps_source_controls_operations.py | 10 +- ...r_apps_source_controls_operations_async.py | 10 +- ...omponent_resiliency_policies_operations.py | 103 + ...nt_resiliency_policies_operations_async.py | 104 + ...ner_apps_api_dapr_components_operations.py | 13 +- ...ps_api_dapr_components_operations_async.py | 13 +- ..._apps_api_dapr_subscriptions_operations.py | 90 + ...api_dapr_subscriptions_operations_async.py | 91 + ..._apps_api_dot_net_components_operations.py | 117 + ...api_dot_net_components_operations_async.py | 124 + ...apps_api_functions_extension_operations.py | 33 + ...pi_functions_extension_operations_async.py | 34 + ...ner_apps_api_java_components_operations.py | 111 + ...ps_api_java_components_operations_async.py | 118 + ...ner_apps_api_jobs_executions_operations.py | 2 +- ...ps_api_jobs_executions_operations_async.py | 2 +- ...test_container_apps_api_jobs_operations.py | 61 +- ...ontainer_apps_api_jobs_operations_async.py | 65 +- ...ontainer_apps_api_logic_apps_operations.py | 140 + ...er_apps_api_logic_apps_operations_async.py | 141 + ...pps_api_managed_certificates_operations.py | 10 +- ...i_managed_certificates_operations_async.py | 10 +- ...aged_environment_diagnostics_operations.py | 4 +- ...nvironment_diagnostics_operations_async.py | 4 +- ...private_endpoint_connections_operations.py | 87 + ...e_endpoint_connections_operations_async.py | 96 + ...nment_private_link_resources_operations.py | 31 + ...private_link_resources_operations_async.py | 32 + ...i_managed_environment_usages_operations.py | 2 +- ...ged_environment_usages_operations_async.py | 2 +- ...ged_environments_diagnostics_operations.py | 2 +- ...vironments_diagnostics_operations_async.py | 2 +- ...pps_api_managed_environments_operations.py | 132 +- ...i_managed_environments_operations_async.py | 140 +- ...anaged_environments_storages_operations.py | 11 +- ..._environments_storages_operations_async.py | 11 +- ...ontainer_apps_api_namespaces_operations.py | 2 +- ...er_apps_api_namespaces_operations_async.py | 2 +- .../test_container_apps_api_operations.py | 2 +- ...est_container_apps_api_operations_async.py | 2 +- ...st_container_apps_api_usages_operations.py | 2 +- ...tainer_apps_api_usages_operations_async.py | 2 +- 371 files changed, 34764 insertions(+), 2966 deletions(-) create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_app_resiliency_operations.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_build_auth_token_operations.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_builders_operations.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_builds_by_builder_resource_operations.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_builds_operations.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_builds_by_container_app_operations.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_builds_operations.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_patches_operations.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_session_pools_operations.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_dapr_component_resiliency_policies_operations.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_dapr_subscriptions_operations.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_dot_net_components_operations.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_functions_extension_operations.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_java_components_operations.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_logic_apps_operations.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environment_private_endpoint_connections_operations.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environment_private_link_resources_operations.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_app_resiliency_operations.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_build_auth_token_operations.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_builders_operations.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_builds_by_builder_resource_operations.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_builds_operations.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_builds_by_container_app_operations.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_builds_operations.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_patches_operations.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_session_pools_operations.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_dapr_component_resiliency_policies_operations.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_dapr_subscriptions_operations.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_dot_net_components_operations.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_functions_extension_operations.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_java_components_operations.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_logic_apps_operations.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environment_private_endpoint_connections_operations.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environment_private_link_resources_operations.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_create_or_update.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_delete.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_get.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_list.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_patch.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_create_or_update.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_delete.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_get.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_list_by_resource_group.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_list_by_subscription.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_update.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_create_or_update.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_delete.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_get.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_list_auth_token.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_list_by_builder_resource.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_create_or_update_from_key_vault.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_builds_delete.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_builds_get.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_builds_list_by_container_app.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_create_or_update_connected_environment.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_kind_create_or_update.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_patches_apply.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_patches_delete.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_patches_get.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_patches_list_by_container_app.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_patches_skip_configure.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_source_to_cloud_app_create_or_update.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policies_delete.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policies_get.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policies_list.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policy_create_or_update_all_options.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policy_create_or_update_outbound_only.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policy_create_or_update_sparse_options.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_create_or_update_bulk_subscribe_and_scopes.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_create_or_update_default_route.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_create_or_update_route_rules_and_metadata.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_delete.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_get_bulk_subscribe_and_scopes.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_get_default_route.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_get_route_rules_and_metadata.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_list.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_create_or_update.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_create_or_update_service_bind.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_delete.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_get.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_get_service_bind.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_list.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_list_service_bind.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_patch.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_patch_service_bind.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/functions_extension_post.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_create_or_update.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_create_or_update_service_bind.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_delete.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_get.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_get_service_bind.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_list.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_list_service_bind.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_patch.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_patch_service_bind.py delete mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_createor_update.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/jobs_resume.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/jobs_suspend.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_create.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_delete.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_delete_deploy_workflow_artifacts.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_get.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_get_workflow.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_list_connections.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_list_workflows.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_post_deploy_workflow_artifacts.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_private_endpoint_connections_create_or_update.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_private_endpoint_connections_delete.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_private_endpoint_connections_get.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_private_endpoint_connections_list.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_private_link_resources_list.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_create_or_update_nfs_azure_file.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_get_nfs_azure_file.py rename sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/{job_createor_update_event_trigger.py => session_pools_create_or_update.py} (54%) create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/session_pools_delete.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/session_pools_get.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/session_pools_list_by_resource_group.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/session_pools_list_by_subscription.py rename sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/{job_patch.py => session_pools_patch.py} (51%) create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_app_resiliency_operations.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_app_resiliency_operations_async.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_build_auth_token_operations.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_build_auth_token_operations_async.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_builders_operations.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_builders_operations_async.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_builds_by_builder_resource_operations.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_builds_by_builder_resource_operations_async.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_builds_operations.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_builds_operations_async.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_builds_by_container_app_operations.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_builds_by_container_app_operations_async.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_builds_operations.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_builds_operations_async.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_patches_operations.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_patches_operations_async.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_session_pools_operations.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_session_pools_operations_async.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dapr_component_resiliency_policies_operations.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dapr_component_resiliency_policies_operations_async.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dapr_subscriptions_operations.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dapr_subscriptions_operations_async.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dot_net_components_operations.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dot_net_components_operations_async.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_functions_extension_operations.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_functions_extension_operations_async.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_java_components_operations.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_java_components_operations_async.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_logic_apps_operations.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_logic_apps_operations_async.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_private_endpoint_connections_operations.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_private_endpoint_connections_operations_async.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_private_link_resources_operations.py create mode 100644 sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_private_link_resources_operations_async.py diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/_meta.json b/sdk/appcontainers/azure-mgmt-appcontainers/_meta.json index bbe75cc919e3..b6bf02d0c770 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/_meta.json +++ b/sdk/appcontainers/azure-mgmt-appcontainers/_meta.json @@ -1,11 +1,11 @@ { - "commit": "c4b33165c43ba9253bb5b36a8c907dbef570bb6f", + "commit": "bb1768f218c164bd56da0f6ee02e2e1bdfb4d34f", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.10.2", "use": [ - "@autorest/python@6.17.0", + "@autorest/python@6.19.0", "@autorest/modelerfour@4.27.0" ], - "autorest_command": "autorest specification/app/resource-manager/readme.md --generate-sample=True --generate-test=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --tag=package-2024-03 --use=@autorest/python@6.17.0 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", + "autorest_command": "autorest specification/app/resource-manager/readme.md --generate-sample=True --generate-test=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.19.0 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", "readme": "specification/app/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_configuration.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_configuration.py index 6b5bc3fc5696..af2e666061c1 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_configuration.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_configuration.py @@ -26,15 +26,15 @@ class ContainerAppsAPIClientConfiguration: # pylint: disable=too-many-instance- :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The ID of the target subscription. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2024-03-01". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2024-08-02-preview". Note that overriding + this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2024-03-01") + api_version: str = kwargs.pop("api_version", "2024-08-02-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_container_apps_api_client.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_container_apps_api_client.py index f39b86b8ebb1..c9c41bc93026 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_container_apps_api_client.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_container_apps_api_client.py @@ -19,8 +19,13 @@ from ._configuration import ContainerAppsAPIClientConfiguration from ._serialization import Deserializer, Serializer from .operations import ( + AppResiliencyOperations, AvailableWorkloadProfilesOperations, BillingMetersOperations, + BuildAuthTokenOperations, + BuildersOperations, + BuildsByBuilderResourceOperations, + BuildsOperations, CertificatesOperations, ConnectedEnvironmentsCertificatesOperations, ConnectedEnvironmentsDaprComponentsOperations, @@ -28,16 +33,28 @@ ConnectedEnvironmentsStoragesOperations, ContainerAppsAPIClientOperationsMixin, ContainerAppsAuthConfigsOperations, + ContainerAppsBuildsByContainerAppOperations, + ContainerAppsBuildsOperations, ContainerAppsDiagnosticsOperations, ContainerAppsOperations, + ContainerAppsPatchesOperations, ContainerAppsRevisionReplicasOperations, ContainerAppsRevisionsOperations, + ContainerAppsSessionPoolsOperations, ContainerAppsSourceControlsOperations, + DaprComponentResiliencyPoliciesOperations, DaprComponentsOperations, + DaprSubscriptionsOperations, + DotNetComponentsOperations, + FunctionsExtensionOperations, + JavaComponentsOperations, JobsExecutionsOperations, JobsOperations, + LogicAppsOperations, ManagedCertificatesOperations, ManagedEnvironmentDiagnosticsOperations, + ManagedEnvironmentPrivateEndpointConnectionsOperations, + ManagedEnvironmentPrivateLinkResourcesOperations, ManagedEnvironmentUsagesOperations, ManagedEnvironmentsDiagnosticsOperations, ManagedEnvironmentsOperations, @@ -55,8 +72,12 @@ class ContainerAppsAPIClient( ContainerAppsAPIClientOperationsMixin ): # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes - """ContainerAppsAPIClient. + """Functions is an extension resource to revisions and the api listed is used to proxy the call + from Web RP to the function app's host process, this api is not exposed to users and only Web + RP is allowed to invoke functions extension resource. + :ivar app_resiliency: AppResiliencyOperations operations + :vartype app_resiliency: azure.mgmt.appcontainers.operations.AppResiliencyOperations :ivar container_apps_auth_configs: ContainerAppsAuthConfigsOperations operations :vartype container_apps_auth_configs: azure.mgmt.appcontainers.operations.ContainerAppsAuthConfigsOperations @@ -65,6 +86,15 @@ class ContainerAppsAPIClient( azure.mgmt.appcontainers.operations.AvailableWorkloadProfilesOperations :ivar billing_meters: BillingMetersOperations operations :vartype billing_meters: azure.mgmt.appcontainers.operations.BillingMetersOperations + :ivar builders: BuildersOperations operations + :vartype builders: azure.mgmt.appcontainers.operations.BuildersOperations + :ivar builds_by_builder_resource: BuildsByBuilderResourceOperations operations + :vartype builds_by_builder_resource: + azure.mgmt.appcontainers.operations.BuildsByBuilderResourceOperations + :ivar builds: BuildsOperations operations + :vartype builds: azure.mgmt.appcontainers.operations.BuildsOperations + :ivar build_auth_token: BuildAuthTokenOperations operations + :vartype build_auth_token: azure.mgmt.appcontainers.operations.BuildAuthTokenOperations :ivar connected_environments: ConnectedEnvironmentsOperations operations :vartype connected_environments: azure.mgmt.appcontainers.operations.ConnectedEnvironmentsOperations @@ -81,6 +111,16 @@ class ContainerAppsAPIClient( azure.mgmt.appcontainers.operations.ConnectedEnvironmentsStoragesOperations :ivar container_apps: ContainerAppsOperations operations :vartype container_apps: azure.mgmt.appcontainers.operations.ContainerAppsOperations + :ivar container_apps_builds_by_container_app: ContainerAppsBuildsByContainerAppOperations + operations + :vartype container_apps_builds_by_container_app: + azure.mgmt.appcontainers.operations.ContainerAppsBuildsByContainerAppOperations + :ivar container_apps_builds: ContainerAppsBuildsOperations operations + :vartype container_apps_builds: + azure.mgmt.appcontainers.operations.ContainerAppsBuildsOperations + :ivar container_apps_patches: ContainerAppsPatchesOperations operations + :vartype container_apps_patches: + azure.mgmt.appcontainers.operations.ContainerAppsPatchesOperations :ivar container_apps_revisions: ContainerAppsRevisionsOperations operations :vartype container_apps_revisions: azure.mgmt.appcontainers.operations.ContainerAppsRevisionsOperations @@ -98,10 +138,18 @@ class ContainerAppsAPIClient( azure.mgmt.appcontainers.operations.ManagedEnvironmentsDiagnosticsOperations :ivar jobs: JobsOperations operations :vartype jobs: azure.mgmt.appcontainers.operations.JobsOperations + :ivar dot_net_components: DotNetComponentsOperations operations + :vartype dot_net_components: azure.mgmt.appcontainers.operations.DotNetComponentsOperations + :ivar functions_extension: FunctionsExtensionOperations operations + :vartype functions_extension: azure.mgmt.appcontainers.operations.FunctionsExtensionOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.appcontainers.operations.Operations + :ivar java_components: JavaComponentsOperations operations + :vartype java_components: azure.mgmt.appcontainers.operations.JavaComponentsOperations :ivar jobs_executions: JobsExecutionsOperations operations :vartype jobs_executions: azure.mgmt.appcontainers.operations.JobsExecutionsOperations + :ivar logic_apps: LogicAppsOperations operations + :vartype logic_apps: azure.mgmt.appcontainers.operations.LogicAppsOperations :ivar managed_environments: ManagedEnvironmentsOperations operations :vartype managed_environments: azure.mgmt.appcontainers.operations.ManagedEnvironmentsOperations @@ -112,11 +160,27 @@ class ContainerAppsAPIClient( azure.mgmt.appcontainers.operations.ManagedCertificatesOperations :ivar namespaces: NamespacesOperations operations :vartype namespaces: azure.mgmt.appcontainers.operations.NamespacesOperations + :ivar managed_environment_private_endpoint_connections: + ManagedEnvironmentPrivateEndpointConnectionsOperations operations + :vartype managed_environment_private_endpoint_connections: + azure.mgmt.appcontainers.operations.ManagedEnvironmentPrivateEndpointConnectionsOperations + :ivar managed_environment_private_link_resources: + ManagedEnvironmentPrivateLinkResourcesOperations operations + :vartype managed_environment_private_link_resources: + azure.mgmt.appcontainers.operations.ManagedEnvironmentPrivateLinkResourcesOperations + :ivar dapr_component_resiliency_policies: DaprComponentResiliencyPoliciesOperations operations + :vartype dapr_component_resiliency_policies: + azure.mgmt.appcontainers.operations.DaprComponentResiliencyPoliciesOperations :ivar dapr_components: DaprComponentsOperations operations :vartype dapr_components: azure.mgmt.appcontainers.operations.DaprComponentsOperations + :ivar dapr_subscriptions: DaprSubscriptionsOperations operations + :vartype dapr_subscriptions: azure.mgmt.appcontainers.operations.DaprSubscriptionsOperations :ivar managed_environments_storages: ManagedEnvironmentsStoragesOperations operations :vartype managed_environments_storages: azure.mgmt.appcontainers.operations.ManagedEnvironmentsStoragesOperations + :ivar container_apps_session_pools: ContainerAppsSessionPoolsOperations operations + :vartype container_apps_session_pools: + azure.mgmt.appcontainers.operations.ContainerAppsSessionPoolsOperations :ivar container_apps_source_controls: ContainerAppsSourceControlsOperations operations :vartype container_apps_source_controls: azure.mgmt.appcontainers.operations.ContainerAppsSourceControlsOperations @@ -127,12 +191,12 @@ class ContainerAppsAPIClient( azure.mgmt.appcontainers.operations.ManagedEnvironmentUsagesOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The ID of the target subscription. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2024-03-01". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2024-08-02-preview". Note that overriding + this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. @@ -172,6 +236,7 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False + self.app_resiliency = AppResiliencyOperations(self._client, self._config, self._serialize, self._deserialize) self.container_apps_auth_configs = ContainerAppsAuthConfigsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -179,6 +244,12 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.billing_meters = BillingMetersOperations(self._client, self._config, self._serialize, self._deserialize) + self.builders = BuildersOperations(self._client, self._config, self._serialize, self._deserialize) + self.builds_by_builder_resource = BuildsByBuilderResourceOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.builds = BuildsOperations(self._client, self._config, self._serialize, self._deserialize) + self.build_auth_token = BuildAuthTokenOperations(self._client, self._config, self._serialize, self._deserialize) self.connected_environments = ConnectedEnvironmentsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -192,6 +263,15 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.container_apps = ContainerAppsOperations(self._client, self._config, self._serialize, self._deserialize) + self.container_apps_builds_by_container_app = ContainerAppsBuildsByContainerAppOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.container_apps_builds = ContainerAppsBuildsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.container_apps_patches = ContainerAppsPatchesOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.container_apps_revisions = ContainerAppsRevisionsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -208,8 +288,16 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) + self.dot_net_components = DotNetComponentsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.functions_extension = FunctionsExtensionOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.java_components = JavaComponentsOperations(self._client, self._config, self._serialize, self._deserialize) self.jobs_executions = JobsExecutionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.logic_apps = LogicAppsOperations(self._client, self._config, self._serialize, self._deserialize) self.managed_environments = ManagedEnvironmentsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -218,10 +306,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.managed_environments_storages = ManagedEnvironmentsStoragesOperations( self._client, self._config, self._serialize, self._deserialize ) + self.container_apps_session_pools = ContainerAppsSessionPoolsOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.container_apps_source_controls = ContainerAppsSourceControlsOperations( self._client, self._config, self._serialize, self._deserialize ) diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_version.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_version.py index 47babc28d5ed..e5754a47ce68 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_version.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/_configuration.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/_configuration.py index 4b656c0dc270..8cae65231135 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/_configuration.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/_configuration.py @@ -26,15 +26,15 @@ class ContainerAppsAPIClientConfiguration: # pylint: disable=too-many-instance- :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The ID of the target subscription. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2024-03-01". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2024-08-02-preview". Note that overriding + this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2024-03-01") + api_version: str = kwargs.pop("api_version", "2024-08-02-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/_container_apps_api_client.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/_container_apps_api_client.py index 9737997ee424..3bec301c96c4 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/_container_apps_api_client.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/_container_apps_api_client.py @@ -19,8 +19,13 @@ from .._serialization import Deserializer, Serializer from ._configuration import ContainerAppsAPIClientConfiguration from .operations import ( + AppResiliencyOperations, AvailableWorkloadProfilesOperations, BillingMetersOperations, + BuildAuthTokenOperations, + BuildersOperations, + BuildsByBuilderResourceOperations, + BuildsOperations, CertificatesOperations, ConnectedEnvironmentsCertificatesOperations, ConnectedEnvironmentsDaprComponentsOperations, @@ -28,16 +33,28 @@ ConnectedEnvironmentsStoragesOperations, ContainerAppsAPIClientOperationsMixin, ContainerAppsAuthConfigsOperations, + ContainerAppsBuildsByContainerAppOperations, + ContainerAppsBuildsOperations, ContainerAppsDiagnosticsOperations, ContainerAppsOperations, + ContainerAppsPatchesOperations, ContainerAppsRevisionReplicasOperations, ContainerAppsRevisionsOperations, + ContainerAppsSessionPoolsOperations, ContainerAppsSourceControlsOperations, + DaprComponentResiliencyPoliciesOperations, DaprComponentsOperations, + DaprSubscriptionsOperations, + DotNetComponentsOperations, + FunctionsExtensionOperations, + JavaComponentsOperations, JobsExecutionsOperations, JobsOperations, + LogicAppsOperations, ManagedCertificatesOperations, ManagedEnvironmentDiagnosticsOperations, + ManagedEnvironmentPrivateEndpointConnectionsOperations, + ManagedEnvironmentPrivateLinkResourcesOperations, ManagedEnvironmentUsagesOperations, ManagedEnvironmentsDiagnosticsOperations, ManagedEnvironmentsOperations, @@ -55,8 +72,12 @@ class ContainerAppsAPIClient( ContainerAppsAPIClientOperationsMixin ): # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes - """ContainerAppsAPIClient. + """Functions is an extension resource to revisions and the api listed is used to proxy the call + from Web RP to the function app's host process, this api is not exposed to users and only Web + RP is allowed to invoke functions extension resource. + :ivar app_resiliency: AppResiliencyOperations operations + :vartype app_resiliency: azure.mgmt.appcontainers.aio.operations.AppResiliencyOperations :ivar container_apps_auth_configs: ContainerAppsAuthConfigsOperations operations :vartype container_apps_auth_configs: azure.mgmt.appcontainers.aio.operations.ContainerAppsAuthConfigsOperations @@ -65,6 +86,15 @@ class ContainerAppsAPIClient( azure.mgmt.appcontainers.aio.operations.AvailableWorkloadProfilesOperations :ivar billing_meters: BillingMetersOperations operations :vartype billing_meters: azure.mgmt.appcontainers.aio.operations.BillingMetersOperations + :ivar builders: BuildersOperations operations + :vartype builders: azure.mgmt.appcontainers.aio.operations.BuildersOperations + :ivar builds_by_builder_resource: BuildsByBuilderResourceOperations operations + :vartype builds_by_builder_resource: + azure.mgmt.appcontainers.aio.operations.BuildsByBuilderResourceOperations + :ivar builds: BuildsOperations operations + :vartype builds: azure.mgmt.appcontainers.aio.operations.BuildsOperations + :ivar build_auth_token: BuildAuthTokenOperations operations + :vartype build_auth_token: azure.mgmt.appcontainers.aio.operations.BuildAuthTokenOperations :ivar connected_environments: ConnectedEnvironmentsOperations operations :vartype connected_environments: azure.mgmt.appcontainers.aio.operations.ConnectedEnvironmentsOperations @@ -81,6 +111,16 @@ class ContainerAppsAPIClient( azure.mgmt.appcontainers.aio.operations.ConnectedEnvironmentsStoragesOperations :ivar container_apps: ContainerAppsOperations operations :vartype container_apps: azure.mgmt.appcontainers.aio.operations.ContainerAppsOperations + :ivar container_apps_builds_by_container_app: ContainerAppsBuildsByContainerAppOperations + operations + :vartype container_apps_builds_by_container_app: + azure.mgmt.appcontainers.aio.operations.ContainerAppsBuildsByContainerAppOperations + :ivar container_apps_builds: ContainerAppsBuildsOperations operations + :vartype container_apps_builds: + azure.mgmt.appcontainers.aio.operations.ContainerAppsBuildsOperations + :ivar container_apps_patches: ContainerAppsPatchesOperations operations + :vartype container_apps_patches: + azure.mgmt.appcontainers.aio.operations.ContainerAppsPatchesOperations :ivar container_apps_revisions: ContainerAppsRevisionsOperations operations :vartype container_apps_revisions: azure.mgmt.appcontainers.aio.operations.ContainerAppsRevisionsOperations @@ -98,10 +138,19 @@ class ContainerAppsAPIClient( azure.mgmt.appcontainers.aio.operations.ManagedEnvironmentsDiagnosticsOperations :ivar jobs: JobsOperations operations :vartype jobs: azure.mgmt.appcontainers.aio.operations.JobsOperations + :ivar dot_net_components: DotNetComponentsOperations operations + :vartype dot_net_components: azure.mgmt.appcontainers.aio.operations.DotNetComponentsOperations + :ivar functions_extension: FunctionsExtensionOperations operations + :vartype functions_extension: + azure.mgmt.appcontainers.aio.operations.FunctionsExtensionOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.appcontainers.aio.operations.Operations + :ivar java_components: JavaComponentsOperations operations + :vartype java_components: azure.mgmt.appcontainers.aio.operations.JavaComponentsOperations :ivar jobs_executions: JobsExecutionsOperations operations :vartype jobs_executions: azure.mgmt.appcontainers.aio.operations.JobsExecutionsOperations + :ivar logic_apps: LogicAppsOperations operations + :vartype logic_apps: azure.mgmt.appcontainers.aio.operations.LogicAppsOperations :ivar managed_environments: ManagedEnvironmentsOperations operations :vartype managed_environments: azure.mgmt.appcontainers.aio.operations.ManagedEnvironmentsOperations @@ -112,11 +161,28 @@ class ContainerAppsAPIClient( azure.mgmt.appcontainers.aio.operations.ManagedCertificatesOperations :ivar namespaces: NamespacesOperations operations :vartype namespaces: azure.mgmt.appcontainers.aio.operations.NamespacesOperations + :ivar managed_environment_private_endpoint_connections: + ManagedEnvironmentPrivateEndpointConnectionsOperations operations + :vartype managed_environment_private_endpoint_connections: + azure.mgmt.appcontainers.aio.operations.ManagedEnvironmentPrivateEndpointConnectionsOperations + :ivar managed_environment_private_link_resources: + ManagedEnvironmentPrivateLinkResourcesOperations operations + :vartype managed_environment_private_link_resources: + azure.mgmt.appcontainers.aio.operations.ManagedEnvironmentPrivateLinkResourcesOperations + :ivar dapr_component_resiliency_policies: DaprComponentResiliencyPoliciesOperations operations + :vartype dapr_component_resiliency_policies: + azure.mgmt.appcontainers.aio.operations.DaprComponentResiliencyPoliciesOperations :ivar dapr_components: DaprComponentsOperations operations :vartype dapr_components: azure.mgmt.appcontainers.aio.operations.DaprComponentsOperations + :ivar dapr_subscriptions: DaprSubscriptionsOperations operations + :vartype dapr_subscriptions: + azure.mgmt.appcontainers.aio.operations.DaprSubscriptionsOperations :ivar managed_environments_storages: ManagedEnvironmentsStoragesOperations operations :vartype managed_environments_storages: azure.mgmt.appcontainers.aio.operations.ManagedEnvironmentsStoragesOperations + :ivar container_apps_session_pools: ContainerAppsSessionPoolsOperations operations + :vartype container_apps_session_pools: + azure.mgmt.appcontainers.aio.operations.ContainerAppsSessionPoolsOperations :ivar container_apps_source_controls: ContainerAppsSourceControlsOperations operations :vartype container_apps_source_controls: azure.mgmt.appcontainers.aio.operations.ContainerAppsSourceControlsOperations @@ -127,12 +193,12 @@ class ContainerAppsAPIClient( azure.mgmt.appcontainers.aio.operations.ManagedEnvironmentUsagesOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The ID of the target subscription. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2024-03-01". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2024-08-02-preview". Note that overriding + this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. @@ -172,6 +238,7 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False + self.app_resiliency = AppResiliencyOperations(self._client, self._config, self._serialize, self._deserialize) self.container_apps_auth_configs = ContainerAppsAuthConfigsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -179,6 +246,12 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.billing_meters = BillingMetersOperations(self._client, self._config, self._serialize, self._deserialize) + self.builders = BuildersOperations(self._client, self._config, self._serialize, self._deserialize) + self.builds_by_builder_resource = BuildsByBuilderResourceOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.builds = BuildsOperations(self._client, self._config, self._serialize, self._deserialize) + self.build_auth_token = BuildAuthTokenOperations(self._client, self._config, self._serialize, self._deserialize) self.connected_environments = ConnectedEnvironmentsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -192,6 +265,15 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.container_apps = ContainerAppsOperations(self._client, self._config, self._serialize, self._deserialize) + self.container_apps_builds_by_container_app = ContainerAppsBuildsByContainerAppOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.container_apps_builds = ContainerAppsBuildsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.container_apps_patches = ContainerAppsPatchesOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.container_apps_revisions = ContainerAppsRevisionsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -208,8 +290,16 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) + self.dot_net_components = DotNetComponentsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.functions_extension = FunctionsExtensionOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.java_components = JavaComponentsOperations(self._client, self._config, self._serialize, self._deserialize) self.jobs_executions = JobsExecutionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.logic_apps = LogicAppsOperations(self._client, self._config, self._serialize, self._deserialize) self.managed_environments = ManagedEnvironmentsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -218,10 +308,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.managed_environments_storages = ManagedEnvironmentsStoragesOperations( self._client, self._config, self._serialize, self._deserialize ) + self.container_apps_session_pools = ContainerAppsSessionPoolsOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.container_apps_source_controls = ContainerAppsSourceControlsOperations( self._client, self._config, self._serialize, self._deserialize ) diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/__init__.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/__init__.py index 1d1af7c18205..f105aaf0a686 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/__init__.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/__init__.py @@ -6,29 +6,48 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from ._app_resiliency_operations import AppResiliencyOperations from ._container_apps_auth_configs_operations import ContainerAppsAuthConfigsOperations from ._available_workload_profiles_operations import AvailableWorkloadProfilesOperations from ._billing_meters_operations import BillingMetersOperations +from ._builders_operations import BuildersOperations +from ._builds_by_builder_resource_operations import BuildsByBuilderResourceOperations +from ._builds_operations import BuildsOperations +from ._build_auth_token_operations import BuildAuthTokenOperations from ._connected_environments_operations import ConnectedEnvironmentsOperations from ._connected_environments_certificates_operations import ConnectedEnvironmentsCertificatesOperations from ._connected_environments_dapr_components_operations import ConnectedEnvironmentsDaprComponentsOperations from ._connected_environments_storages_operations import ConnectedEnvironmentsStoragesOperations from ._container_apps_operations import ContainerAppsOperations +from ._container_apps_builds_by_container_app_operations import ContainerAppsBuildsByContainerAppOperations +from ._container_apps_builds_operations import ContainerAppsBuildsOperations +from ._container_apps_patches_operations import ContainerAppsPatchesOperations from ._container_apps_revisions_operations import ContainerAppsRevisionsOperations from ._container_apps_revision_replicas_operations import ContainerAppsRevisionReplicasOperations from ._container_apps_diagnostics_operations import ContainerAppsDiagnosticsOperations from ._managed_environment_diagnostics_operations import ManagedEnvironmentDiagnosticsOperations from ._managed_environments_diagnostics_operations import ManagedEnvironmentsDiagnosticsOperations from ._jobs_operations import JobsOperations +from ._dot_net_components_operations import DotNetComponentsOperations +from ._functions_extension_operations import FunctionsExtensionOperations from ._operations import Operations +from ._java_components_operations import JavaComponentsOperations from ._jobs_executions_operations import JobsExecutionsOperations from ._container_apps_api_client_operations import ContainerAppsAPIClientOperationsMixin +from ._logic_apps_operations import LogicAppsOperations from ._managed_environments_operations import ManagedEnvironmentsOperations from ._certificates_operations import CertificatesOperations from ._managed_certificates_operations import ManagedCertificatesOperations from ._namespaces_operations import NamespacesOperations +from ._managed_environment_private_endpoint_connections_operations import ( + ManagedEnvironmentPrivateEndpointConnectionsOperations, +) +from ._managed_environment_private_link_resources_operations import ManagedEnvironmentPrivateLinkResourcesOperations +from ._dapr_component_resiliency_policies_operations import DaprComponentResiliencyPoliciesOperations from ._dapr_components_operations import DaprComponentsOperations +from ._dapr_subscriptions_operations import DaprSubscriptionsOperations from ._managed_environments_storages_operations import ManagedEnvironmentsStoragesOperations +from ._container_apps_session_pools_operations import ContainerAppsSessionPoolsOperations from ._container_apps_source_controls_operations import ContainerAppsSourceControlsOperations from ._usages_operations import UsagesOperations from ._managed_environment_usages_operations import ManagedEnvironmentUsagesOperations @@ -38,29 +57,46 @@ from ._patch import patch_sdk as _patch_sdk __all__ = [ + "AppResiliencyOperations", "ContainerAppsAuthConfigsOperations", "AvailableWorkloadProfilesOperations", "BillingMetersOperations", + "BuildersOperations", + "BuildsByBuilderResourceOperations", + "BuildsOperations", + "BuildAuthTokenOperations", "ConnectedEnvironmentsOperations", "ConnectedEnvironmentsCertificatesOperations", "ConnectedEnvironmentsDaprComponentsOperations", "ConnectedEnvironmentsStoragesOperations", "ContainerAppsOperations", + "ContainerAppsBuildsByContainerAppOperations", + "ContainerAppsBuildsOperations", + "ContainerAppsPatchesOperations", "ContainerAppsRevisionsOperations", "ContainerAppsRevisionReplicasOperations", "ContainerAppsDiagnosticsOperations", "ManagedEnvironmentDiagnosticsOperations", "ManagedEnvironmentsDiagnosticsOperations", "JobsOperations", + "DotNetComponentsOperations", + "FunctionsExtensionOperations", "Operations", + "JavaComponentsOperations", "JobsExecutionsOperations", "ContainerAppsAPIClientOperationsMixin", + "LogicAppsOperations", "ManagedEnvironmentsOperations", "CertificatesOperations", "ManagedCertificatesOperations", "NamespacesOperations", + "ManagedEnvironmentPrivateEndpointConnectionsOperations", + "ManagedEnvironmentPrivateLinkResourcesOperations", + "DaprComponentResiliencyPoliciesOperations", "DaprComponentsOperations", + "DaprSubscriptionsOperations", "ManagedEnvironmentsStoragesOperations", + "ContainerAppsSessionPoolsOperations", "ContainerAppsSourceControlsOperations", "UsagesOperations", "ManagedEnvironmentUsagesOperations", diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_app_resiliency_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_app_resiliency_operations.py new file mode 100644 index 000000000000..4ca3515c3463 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_app_resiliency_operations.py @@ -0,0 +1,562 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ...operations._app_resiliency_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, + build_update_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class AppResiliencyOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.aio.ContainerAppsAPIClient`'s + :attr:`app_resiliency` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @overload + async def create_or_update( + self, + resource_group_name: str, + app_name: str, + name: str, + resiliency_envelope: _models.AppResiliency, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AppResiliency: + """Create or update an application's resiliency policy. + + Create or update container app resiliency policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_name: Name of the Container App. Required. + :type app_name: str + :param name: Name of the resiliency policy. Required. + :type name: str + :param resiliency_envelope: The resiliency policy to create or update. Required. + :type resiliency_envelope: ~azure.mgmt.appcontainers.models.AppResiliency + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: AppResiliency or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.AppResiliency + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + app_name: str, + name: str, + resiliency_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AppResiliency: + """Create or update an application's resiliency policy. + + Create or update container app resiliency policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_name: Name of the Container App. Required. + :type app_name: str + :param name: Name of the resiliency policy. Required. + :type name: str + :param resiliency_envelope: The resiliency policy to create or update. Required. + :type resiliency_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: AppResiliency or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.AppResiliency + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + app_name: str, + name: str, + resiliency_envelope: Union[_models.AppResiliency, IO[bytes]], + **kwargs: Any + ) -> _models.AppResiliency: + """Create or update an application's resiliency policy. + + Create or update container app resiliency policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_name: Name of the Container App. Required. + :type app_name: str + :param name: Name of the resiliency policy. Required. + :type name: str + :param resiliency_envelope: The resiliency policy to create or update. Is either a + AppResiliency type or a IO[bytes] type. Required. + :type resiliency_envelope: ~azure.mgmt.appcontainers.models.AppResiliency or IO[bytes] + :return: AppResiliency or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.AppResiliency + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AppResiliency] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(resiliency_envelope, (IOBase, bytes)): + _content = resiliency_envelope + else: + _json = self._serialize.body(resiliency_envelope, "AppResiliency") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + app_name=app_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AppResiliency", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def update( + self, + resource_group_name: str, + app_name: str, + name: str, + resiliency_envelope: _models.AppResiliency, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AppResiliency: + """Update an application's resiliency policy. + + Update container app resiliency policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_name: Name of the Container App. Required. + :type app_name: str + :param name: Name of the resiliency policy. Required. + :type name: str + :param resiliency_envelope: The resiliency policy to update. Required. + :type resiliency_envelope: ~azure.mgmt.appcontainers.models.AppResiliency + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: AppResiliency or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.AppResiliency + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + app_name: str, + name: str, + resiliency_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AppResiliency: + """Update an application's resiliency policy. + + Update container app resiliency policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_name: Name of the Container App. Required. + :type app_name: str + :param name: Name of the resiliency policy. Required. + :type name: str + :param resiliency_envelope: The resiliency policy to update. Required. + :type resiliency_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: AppResiliency or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.AppResiliency + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + app_name: str, + name: str, + resiliency_envelope: Union[_models.AppResiliency, IO[bytes]], + **kwargs: Any + ) -> _models.AppResiliency: + """Update an application's resiliency policy. + + Update container app resiliency policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_name: Name of the Container App. Required. + :type app_name: str + :param name: Name of the resiliency policy. Required. + :type name: str + :param resiliency_envelope: The resiliency policy to update. Is either a AppResiliency type or + a IO[bytes] type. Required. + :type resiliency_envelope: ~azure.mgmt.appcontainers.models.AppResiliency or IO[bytes] + :return: AppResiliency or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.AppResiliency + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AppResiliency] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(resiliency_envelope, (IOBase, bytes)): + _content = resiliency_envelope + else: + _json = self._serialize.body(resiliency_envelope, "AppResiliency") + + _request = build_update_request( + resource_group_name=resource_group_name, + app_name=app_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AppResiliency", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, app_name: str, name: str, **kwargs: Any + ) -> None: + """Delete an application's resiliency policy. + + Delete container app resiliency policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_name: Name of the Container App. Required. + :type app_name: str + :param name: Name of the resiliency policy. Required. + :type name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + app_name=app_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace_async + async def get(self, resource_group_name: str, app_name: str, name: str, **kwargs: Any) -> _models.AppResiliency: + """Get an application's resiliency policy. + + Get container app resiliency policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_name: Name of the Container App. Required. + :type app_name: str + :param name: Name of the resiliency policy. Required. + :type name: str + :return: AppResiliency or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.AppResiliency + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AppResiliency] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + app_name=app_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AppResiliency", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list(self, resource_group_name: str, app_name: str, **kwargs: Any) -> AsyncIterable["_models.AppResiliency"]: + """List an application's resiliency policies. + + List container app resiliency policies. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_name: Name of the Container App. Required. + :type app_name: str + :return: An iterator like instance of either AppResiliency or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.AppResiliency] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AppResiliencyCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + app_name=app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("AppResiliencyCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_available_workload_profiles_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_available_workload_profiles_operations.py index d4e268c8e17e..007b7f9e95dc 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_available_workload_profiles_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_available_workload_profiles_operations.py @@ -27,7 +27,6 @@ from ... import models as _models from ...operations._available_workload_profiles_operations import build_get_request -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_billing_meters_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_billing_meters_operations.py index 5fb56bf3db61..11596186fb1a 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_billing_meters_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_billing_meters_operations.py @@ -25,7 +25,6 @@ from ... import models as _models from ...operations._billing_meters_operations import build_get_request -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_build_auth_token_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_build_auth_token_operations.py new file mode 100644 index 000000000000..a875471941c0 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_build_auth_token_operations.py @@ -0,0 +1,115 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ...operations._build_auth_token_operations import build_list_request + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class BuildAuthTokenOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.aio.ContainerAppsAPIClient`'s + :attr:`build_auth_token` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def list( + self, resource_group_name: str, builder_name: str, build_name: str, **kwargs: Any + ) -> _models.BuildToken: + """Gets the token used to connect to the endpoint where source code can be uploaded for a build. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param build_name: The name of a build. Required. + :type build_name: str + :return: BuildToken or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.BuildToken + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BuildToken] = kwargs.pop("cls", None) + + _request = build_list_request( + resource_group_name=resource_group_name, + builder_name=builder_name, + build_name=build_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("BuildToken", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_builders_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_builders_operations.py new file mode 100644 index 000000000000..5d01584d4431 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_builders_operations.py @@ -0,0 +1,792 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ...operations._builders_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_resource_group_request, + build_list_by_subscription_request, + build_update_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class BuildersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.aio.ContainerAppsAPIClient`'s + :attr:`builders` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.BuilderResource"]: + """List BuilderResource resources by subscription ID. + + :return: An iterator like instance of either BuilderResource or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.BuilderResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BuilderCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("BuilderCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.BuilderResource"]: + """List BuilderResource resources by resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of either BuilderResource or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.BuilderResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BuilderCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("BuilderCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get(self, resource_group_name: str, builder_name: str, **kwargs: Any) -> _models.BuilderResource: + """Get a BuilderResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :return: BuilderResource or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.BuilderResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + builder_name=builder_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("BuilderResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + builder_name: str, + builder_envelope: Union[_models.BuilderResource, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(builder_envelope, (IOBase, bytes)): + _content = builder_envelope + else: + _json = self._serialize.body(builder_envelope, "BuilderResource") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + builder_name=builder_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + builder_name: str, + builder_envelope: _models.BuilderResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.BuilderResource]: + """Create or update a BuilderResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param builder_envelope: Resource create parameters. Required. + :type builder_envelope: ~azure.mgmt.appcontainers.models.BuilderResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either BuilderResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.BuilderResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + builder_name: str, + builder_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.BuilderResource]: + """Create or update a BuilderResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param builder_envelope: Resource create parameters. Required. + :type builder_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either BuilderResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.BuilderResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + builder_name: str, + builder_envelope: Union[_models.BuilderResource, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.BuilderResource]: + """Create or update a BuilderResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param builder_envelope: Resource create parameters. Is either a BuilderResource type or a + IO[bytes] type. Required. + :type builder_envelope: ~azure.mgmt.appcontainers.models.BuilderResource or IO[bytes] + :return: An instance of AsyncLROPoller that returns either BuilderResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.BuilderResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + builder_name=builder_name, + builder_envelope=builder_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("BuilderResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.BuilderResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.BuilderResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _update_initial( + self, + resource_group_name: str, + builder_name: str, + builder_envelope: Union[_models.BuilderResourceUpdate, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(builder_envelope, (IOBase, bytes)): + _content = builder_envelope + else: + _json = self._serialize.body(builder_envelope, "BuilderResourceUpdate") + + _request = build_update_request( + resource_group_name=resource_group_name, + builder_name=builder_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + builder_name: str, + builder_envelope: _models.BuilderResourceUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.BuilderResource]: + """Update a BuilderResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param builder_envelope: The resource properties to be updated. Required. + :type builder_envelope: ~azure.mgmt.appcontainers.models.BuilderResourceUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either BuilderResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.BuilderResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + builder_name: str, + builder_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.BuilderResource]: + """Update a BuilderResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param builder_envelope: The resource properties to be updated. Required. + :type builder_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either BuilderResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.BuilderResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + builder_name: str, + builder_envelope: Union[_models.BuilderResourceUpdate, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.BuilderResource]: + """Update a BuilderResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param builder_envelope: The resource properties to be updated. Is either a + BuilderResourceUpdate type or a IO[bytes] type. Required. + :type builder_envelope: ~azure.mgmt.appcontainers.models.BuilderResourceUpdate or IO[bytes] + :return: An instance of AsyncLROPoller that returns either BuilderResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.BuilderResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + builder_name=builder_name, + builder_envelope=builder_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("BuilderResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.BuilderResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.BuilderResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial(self, resource_group_name: str, builder_name: str, **kwargs: Any) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + builder_name=builder_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete(self, resource_group_name: str, builder_name: str, **kwargs: Any) -> AsyncLROPoller[None]: + """Delete a BuilderResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + builder_name=builder_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_builds_by_builder_resource_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_builds_by_builder_resource_operations.py new file mode 100644 index 000000000000..56a53acdbbfb --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_builds_by_builder_resource_operations.py @@ -0,0 +1,140 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ...operations._builds_by_builder_resource_operations import build_list_request + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class BuildsByBuilderResourceOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.aio.ContainerAppsAPIClient`'s + :attr:`builds_by_builder_resource` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, resource_group_name: str, builder_name: str, **kwargs: Any + ) -> AsyncIterable["_models.BuildResource"]: + """List BuildResource resources by BuilderResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :return: An iterator like instance of either BuildResource or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.BuildResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BuildCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + builder_name=builder_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("BuildCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_builds_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_builds_operations.py new file mode 100644 index 000000000000..72103545763f --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_builds_operations.py @@ -0,0 +1,450 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import sys +from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ...operations._builds_operations import build_create_or_update_request, build_delete_request, build_get_request + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class BuildsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.aio.ContainerAppsAPIClient`'s + :attr:`builds` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, resource_group_name: str, builder_name: str, build_name: str, **kwargs: Any + ) -> _models.BuildResource: + """Get a BuildResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param build_name: The name of a build. Required. + :type build_name: str + :return: BuildResource or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.BuildResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BuildResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + builder_name=builder_name, + build_name=build_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("BuildResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + builder_name: str, + build_name: str, + build_envelope: Union[_models.BuildResource, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(build_envelope, (IOBase, bytes)): + _content = build_envelope + else: + _json = self._serialize.body(build_envelope, "BuildResource") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + builder_name=builder_name, + build_name=build_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + builder_name: str, + build_name: str, + build_envelope: _models.BuildResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.BuildResource]: + """Create a BuildResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param build_name: The name of a build. Required. + :type build_name: str + :param build_envelope: Resource create or update parameters. Required. + :type build_envelope: ~azure.mgmt.appcontainers.models.BuildResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either BuildResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.BuildResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + builder_name: str, + build_name: str, + build_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.BuildResource]: + """Create a BuildResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param build_name: The name of a build. Required. + :type build_name: str + :param build_envelope: Resource create or update parameters. Required. + :type build_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either BuildResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.BuildResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + builder_name: str, + build_name: str, + build_envelope: Union[_models.BuildResource, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.BuildResource]: + """Create a BuildResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param build_name: The name of a build. Required. + :type build_name: str + :param build_envelope: Resource create or update parameters. Is either a BuildResource type or + a IO[bytes] type. Required. + :type build_envelope: ~azure.mgmt.appcontainers.models.BuildResource or IO[bytes] + :return: An instance of AsyncLROPoller that returns either BuildResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.BuildResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BuildResource] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + builder_name=builder_name, + build_name=build_name, + build_envelope=build_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("BuildResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.BuildResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.BuildResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, resource_group_name: str, builder_name: str, build_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + builder_name=builder_name, + build_name=build_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, builder_name: str, build_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a BuildResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param build_name: The name of a build. Required. + :type build_name: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + builder_name=builder_name, + build_name=build_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_certificates_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_certificates_operations.py index 08246e05e1fa..bada5159b51f 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_certificates_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_certificates_operations.py @@ -35,7 +35,6 @@ build_list_request, build_update_request, ) -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_connected_environments_certificates_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_connected_environments_certificates_operations.py index b54c47d0ef4a..963c94331810 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 @@ -35,7 +35,6 @@ build_list_request, build_update_request, ) -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_connected_environments_dapr_components_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_connected_environments_dapr_components_operations.py index fbf413a22135..d892729a6bac 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 @@ -35,7 +35,6 @@ build_list_request, build_list_secrets_request, ) -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_connected_environments_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_connected_environments_operations.py index 6191edaee4a3..921acd30a914 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_connected_environments_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_connected_environments_operations.py @@ -41,7 +41,6 @@ build_list_by_subscription_request, build_update_request, ) -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_connected_environments_storages_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_connected_environments_storages_operations.py index 70da937ebbc0..00be8a0cd8f8 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 @@ -31,7 +31,6 @@ build_get_request, build_list_request, ) -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_auth_configs_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_auth_configs_operations.py index 25573af0b0d6..5f7d8adfd62e 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_auth_configs_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_auth_configs_operations.py @@ -34,7 +34,6 @@ build_get_request, build_list_by_container_app_request, ) -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_builds_by_container_app_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_builds_by_container_app_operations.py new file mode 100644 index 000000000000..4a1965d111b0 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_builds_by_container_app_operations.py @@ -0,0 +1,142 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ...operations._container_apps_builds_by_container_app_operations import build_list_request + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ContainerAppsBuildsByContainerAppOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.aio.ContainerAppsAPIClient`'s + :attr:`container_apps_builds_by_container_app` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, resource_group_name: str, container_app_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ContainerAppsBuildResource"]: + """List Container Apps Build resources by Container App. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App the Build is associated. Required. + :type container_app_name: str + :return: An iterator like instance of either ContainerAppsBuildResource or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.ContainerAppsBuildResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ContainerAppsBuildCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ContainerAppsBuildCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_builds_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_builds_operations.py new file mode 100644 index 000000000000..c2caea4ecb4e --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_builds_operations.py @@ -0,0 +1,235 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, AsyncIterator, Callable, Dict, Optional, Type, TypeVar, Union, cast + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ...operations._container_apps_builds_operations import build_delete_request, build_get_request + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ContainerAppsBuildsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.aio.ContainerAppsAPIClient`'s + :attr:`container_apps_builds` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, resource_group_name: str, container_app_name: str, build_name: str, **kwargs: Any + ) -> _models.ContainerAppsBuildResource: + """Get a Container Apps Build resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App the Build is associated. Required. + :type container_app_name: str + :param build_name: The name of a build. Required. + :type build_name: str + :return: ContainerAppsBuildResource or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.ContainerAppsBuildResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ContainerAppsBuildResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + build_name=build_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ContainerAppsBuildResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _delete_initial( + self, resource_group_name: str, container_app_name: str, build_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + build_name=build_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, container_app_name: str, build_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a Container Apps Build resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App the Build is associated. Required. + :type container_app_name: str + :param build_name: The name of a build. Required. + :type build_name: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + build_name=build_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_diagnostics_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_diagnostics_operations.py index 05113d05b56b..22cf063d8766 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_diagnostics_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_diagnostics_operations.py @@ -34,7 +34,6 @@ build_list_detectors_request, build_list_revisions_request, ) -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_operations.py index 73af128a7a96..7b5d63dcf798 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_operations.py @@ -45,7 +45,6 @@ build_stop_request, build_update_request, ) -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_patches_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_patches_operations.py new file mode 100644 index 000000000000..7860b774654c --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_patches_operations.py @@ -0,0 +1,664 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ...operations._container_apps_patches_operations import ( + build_apply_request, + build_delete_request, + build_get_request, + build_list_by_container_app_request, + build_skip_configure_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ContainerAppsPatchesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.aio.ContainerAppsAPIClient`'s + :attr:`container_apps_patches` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_container_app( + self, resource_group_name: str, container_app_name: str, filter: Optional[str] = None, **kwargs: Any + ) -> AsyncIterable["_models.ContainerAppsPatchResource"]: + """List Container Apps Patch resources by ContainerApp. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App the Patch is associated. Required. + :type container_app_name: str + :param filter: The filter to apply on the operation. For example, + $filter=properties/patchApplyStatus eq 'Succeeded'. Default value is None. + :type filter: str + :return: An iterator like instance of either ContainerAppsPatchResource or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.ContainerAppsPatchResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.PatchCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_container_app_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + subscription_id=self._config.subscription_id, + filter=filter, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("PatchCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get( + self, resource_group_name: str, container_app_name: str, patch_name: str, **kwargs: Any + ) -> _models.ContainerAppsPatchResource: + """Get details for specific Container Apps Patch by patch name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App the Patch is associated. Required. + :type container_app_name: str + :param patch_name: The name of the patch. Required. + :type patch_name: str + :return: ContainerAppsPatchResource or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.ContainerAppsPatchResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ContainerAppsPatchResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + patch_name=patch_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ContainerAppsPatchResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _delete_initial( + self, resource_group_name: str, container_app_name: str, patch_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + patch_name=patch_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, container_app_name: str, patch_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete specific Container Apps Patch by patch name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App the Patch is associated. Required. + :type container_app_name: str + :param patch_name: The name of the patch. Required. + :type patch_name: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + patch_name=patch_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _skip_configure_initial( + self, + resource_group_name: str, + container_app_name: str, + patch_name: str, + patch_skip_config: Union[_models.PatchSkipConfig, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(patch_skip_config, (IOBase, bytes)): + _content = patch_skip_config + else: + _json = self._serialize.body(patch_skip_config, "PatchSkipConfig") + + _request = build_skip_configure_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + patch_name=patch_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_skip_configure( + self, + resource_group_name: str, + container_app_name: str, + patch_name: str, + patch_skip_config: _models.PatchSkipConfig, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Configure the Container Apps Patch skip option by patch name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App the Patch is associated. Required. + :type container_app_name: str + :param patch_name: The name of the patch. Required. + :type patch_name: str + :param patch_skip_config: Configure patcher to skip a patch or not. Required. + :type patch_skip_config: ~azure.mgmt.appcontainers.models.PatchSkipConfig + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_skip_configure( + self, + resource_group_name: str, + container_app_name: str, + patch_name: str, + patch_skip_config: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Configure the Container Apps Patch skip option by patch name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App the Patch is associated. Required. + :type container_app_name: str + :param patch_name: The name of the patch. Required. + :type patch_name: str + :param patch_skip_config: Configure patcher to skip a patch or not. Required. + :type patch_skip_config: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_skip_configure( + self, + resource_group_name: str, + container_app_name: str, + patch_name: str, + patch_skip_config: Union[_models.PatchSkipConfig, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Configure the Container Apps Patch skip option by patch name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App the Patch is associated. Required. + :type container_app_name: str + :param patch_name: The name of the patch. Required. + :type patch_name: str + :param patch_skip_config: Configure patcher to skip a patch or not. Is either a PatchSkipConfig + type or a IO[bytes] type. Required. + :type patch_skip_config: ~azure.mgmt.appcontainers.models.PatchSkipConfig or IO[bytes] + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._skip_configure_initial( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + patch_name=patch_name, + patch_skip_config=patch_skip_config, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _apply_initial( + self, resource_group_name: str, container_app_name: str, patch_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_apply_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + patch_name=patch_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_apply( + self, resource_group_name: str, container_app_name: str, patch_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.ContainerAppsPatchResource]: + """Apply a Container Apps Patch resource with patch name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App the Patch is associated. Required. + :type container_app_name: str + :param patch_name: The name of the patch. Required. + :type patch_name: str + :return: An instance of AsyncLROPoller that returns either ContainerAppsPatchResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.ContainerAppsPatchResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ContainerAppsPatchResource] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._apply_initial( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + patch_name=patch_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ContainerAppsPatchResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.ContainerAppsPatchResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ContainerAppsPatchResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_revision_replicas_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_revision_replicas_operations.py index 7657e4cccb21..3b22ff21655a 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_revision_replicas_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_revision_replicas_operations.py @@ -28,7 +28,6 @@ build_get_replica_request, build_list_replicas_request, ) -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_revisions_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_revisions_operations.py index 08a0379c363c..40a69d7b2126 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_revisions_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_revisions_operations.py @@ -34,7 +34,6 @@ build_list_revisions_request, build_restart_revision_request, ) -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_session_pools_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_session_pools_operations.py new file mode 100644 index 000000000000..a5a3cec4ed59 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_session_pools_operations.py @@ -0,0 +1,808 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ...operations._container_apps_session_pools_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_resource_group_request, + build_list_by_subscription_request, + build_update_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ContainerAppsSessionPoolsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.aio.ContainerAppsAPIClient`'s + :attr:`container_apps_session_pools` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.SessionPool"]: + """Get the session pools in a given subscription. + + Get the session pools in a given subscription. + + :return: An iterator like instance of either SessionPool or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.SessionPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SessionPoolCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("SessionPoolCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.SessionPool"]: + """Get the session pools in a given resource group of a subscription. + + Get the session pools in a given resource group of a subscription. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of either SessionPool or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.SessionPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SessionPoolCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("SessionPoolCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get(self, resource_group_name: str, session_pool_name: str, **kwargs: Any) -> _models.SessionPool: + """Get the properties of a session pool. + + Get the properties of a session pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param session_pool_name: Name of the session pool. Required. + :type session_pool_name: str + :return: SessionPool or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.SessionPool + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SessionPool] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + session_pool_name=session_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SessionPool", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + session_pool_name: str, + session_pool_envelope: Union[_models.SessionPool, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(session_pool_envelope, (IOBase, bytes)): + _content = session_pool_envelope + else: + _json = self._serialize.body(session_pool_envelope, "SessionPool") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + session_pool_name=session_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + session_pool_name: str, + session_pool_envelope: _models.SessionPool, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SessionPool]: + """Create or update a session pool. + + Create or update a session pool with the given properties. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param session_pool_name: Name of the session pool. Required. + :type session_pool_name: str + :param session_pool_envelope: Properties used to create a session pool. Required. + :type session_pool_envelope: ~azure.mgmt.appcontainers.models.SessionPool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either SessionPool or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.SessionPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + session_pool_name: str, + session_pool_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SessionPool]: + """Create or update a session pool. + + Create or update a session pool with the given properties. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param session_pool_name: Name of the session pool. Required. + :type session_pool_name: str + :param session_pool_envelope: Properties used to create a session pool. Required. + :type session_pool_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either SessionPool or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.SessionPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + session_pool_name: str, + session_pool_envelope: Union[_models.SessionPool, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.SessionPool]: + """Create or update a session pool. + + Create or update a session pool with the given properties. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param session_pool_name: Name of the session pool. Required. + :type session_pool_name: str + :param session_pool_envelope: Properties used to create a session pool. Is either a SessionPool + type or a IO[bytes] type. Required. + :type session_pool_envelope: ~azure.mgmt.appcontainers.models.SessionPool or IO[bytes] + :return: An instance of AsyncLROPoller that returns either SessionPool or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.SessionPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SessionPool] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + session_pool_name=session_pool_name, + session_pool_envelope=session_pool_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("SessionPool", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.SessionPool].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.SessionPool]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _update_initial( + self, + resource_group_name: str, + session_pool_name: str, + session_pool_envelope: Union[_models.SessionPoolUpdatableProperties, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(session_pool_envelope, (IOBase, bytes)): + _content = session_pool_envelope + else: + _json = self._serialize.body(session_pool_envelope, "SessionPoolUpdatableProperties") + + _request = build_update_request( + resource_group_name=resource_group_name, + session_pool_name=session_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + session_pool_name: str, + session_pool_envelope: _models.SessionPoolUpdatableProperties, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SessionPool]: + """Update properties of a session pool. + + Patches a session pool using JSON merge patch. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param session_pool_name: Name of the session pool. Required. + :type session_pool_name: str + :param session_pool_envelope: Properties used to create a session pool. Required. + :type session_pool_envelope: ~azure.mgmt.appcontainers.models.SessionPoolUpdatableProperties + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either SessionPool or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.SessionPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + session_pool_name: str, + session_pool_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SessionPool]: + """Update properties of a session pool. + + Patches a session pool using JSON merge patch. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param session_pool_name: Name of the session pool. Required. + :type session_pool_name: str + :param session_pool_envelope: Properties used to create a session pool. Required. + :type session_pool_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either SessionPool or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.SessionPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + session_pool_name: str, + session_pool_envelope: Union[_models.SessionPoolUpdatableProperties, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.SessionPool]: + """Update properties of a session pool. + + Patches a session pool using JSON merge patch. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param session_pool_name: Name of the session pool. Required. + :type session_pool_name: str + :param session_pool_envelope: Properties used to create a session pool. Is either a + SessionPoolUpdatableProperties type or a IO[bytes] type. Required. + :type session_pool_envelope: ~azure.mgmt.appcontainers.models.SessionPoolUpdatableProperties or + IO[bytes] + :return: An instance of AsyncLROPoller that returns either SessionPool or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.SessionPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SessionPool] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + session_pool_name=session_pool_name, + session_pool_envelope=session_pool_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("SessionPool", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.SessionPool].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.SessionPool]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, resource_group_name: str, session_pool_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + session_pool_name=session_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, session_pool_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a session pool. + + Delete the session pool with the given name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param session_pool_name: Name of the session pool. Required. + :type session_pool_name: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + session_pool_name=session_pool_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_source_controls_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_source_controls_operations.py index 43a0e201411f..8b1407ce04f5 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_source_controls_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_source_controls_operations.py @@ -38,7 +38,6 @@ build_get_request, build_list_by_container_app_request, ) -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -222,6 +221,7 @@ async def _create_or_update_initial( container_app_name: str, source_control_name: str, source_control_envelope: Union[_models.SourceControl, IO[bytes]], + x_ms_github_auxiliary: Optional[str] = None, **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -252,6 +252,7 @@ async def _create_or_update_initial( container_app_name=container_app_name, source_control_name=source_control_name, subscription_id=self._config.subscription_id, + x_ms_github_auxiliary=x_ms_github_auxiliary, api_version=api_version, content_type=content_type, json=_json, @@ -292,6 +293,7 @@ async def begin_create_or_update( container_app_name: str, source_control_name: str, source_control_envelope: _models.SourceControl, + x_ms_github_auxiliary: Optional[str] = None, *, content_type: str = "application/json", **kwargs: Any @@ -310,6 +312,9 @@ async def begin_create_or_update( :param source_control_envelope: Properties used to create a Container App SourceControl. Required. :type source_control_envelope: ~azure.mgmt.appcontainers.models.SourceControl + :param x_ms_github_auxiliary: Github personal access token used for SourceControl. Default + value is None. + :type x_ms_github_auxiliary: str :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -326,6 +331,7 @@ async def begin_create_or_update( container_app_name: str, source_control_name: str, source_control_envelope: IO[bytes], + x_ms_github_auxiliary: Optional[str] = None, *, content_type: str = "application/json", **kwargs: Any @@ -344,6 +350,9 @@ async def begin_create_or_update( :param source_control_envelope: Properties used to create a Container App SourceControl. Required. :type source_control_envelope: IO[bytes] + :param x_ms_github_auxiliary: Github personal access token used for SourceControl. Default + value is None. + :type x_ms_github_auxiliary: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -360,6 +369,7 @@ async def begin_create_or_update( container_app_name: str, source_control_name: str, source_control_envelope: Union[_models.SourceControl, IO[bytes]], + x_ms_github_auxiliary: Optional[str] = None, **kwargs: Any ) -> AsyncLROPoller[_models.SourceControl]: """Create or update the SourceControl for a Container App. @@ -376,6 +386,9 @@ async def begin_create_or_update( :param source_control_envelope: Properties used to create a Container App SourceControl. Is either a SourceControl type or a IO[bytes] type. Required. :type source_control_envelope: ~azure.mgmt.appcontainers.models.SourceControl or IO[bytes] + :param x_ms_github_auxiliary: Github personal access token used for SourceControl. Default + value is None. + :type x_ms_github_auxiliary: str :return: An instance of AsyncLROPoller that returns either SourceControl or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.SourceControl] @@ -396,6 +409,7 @@ async def begin_create_or_update( container_app_name=container_app_name, source_control_name=source_control_name, source_control_envelope=source_control_envelope, + x_ms_github_auxiliary=x_ms_github_auxiliary, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -430,7 +444,14 @@ def get_long_running_output(pipeline_response): ) async def _delete_initial( - self, resource_group_name: str, container_app_name: str, source_control_name: str, **kwargs: Any + self, + resource_group_name: str, + container_app_name: str, + source_control_name: str, + x_ms_github_auxiliary: Optional[str] = None, + ignore_workflow_deletion_failure: Optional[bool] = None, + delete_workflow: Optional[bool] = None, + **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, @@ -451,6 +472,9 @@ async def _delete_initial( container_app_name=container_app_name, source_control_name=source_control_name, subscription_id=self._config.subscription_id, + x_ms_github_auxiliary=x_ms_github_auxiliary, + ignore_workflow_deletion_failure=ignore_workflow_deletion_failure, + delete_workflow=delete_workflow, api_version=api_version, headers=_headers, params=_params, @@ -483,7 +507,14 @@ async def _delete_initial( @distributed_trace_async async def begin_delete( - self, resource_group_name: str, container_app_name: str, source_control_name: str, **kwargs: Any + self, + resource_group_name: str, + container_app_name: str, + source_control_name: str, + x_ms_github_auxiliary: Optional[str] = None, + ignore_workflow_deletion_failure: Optional[bool] = None, + delete_workflow: Optional[bool] = None, + **kwargs: Any ) -> AsyncLROPoller[None]: """Delete a Container App SourceControl. @@ -496,6 +527,14 @@ async def begin_delete( :type container_app_name: str :param source_control_name: Name of the Container App SourceControl. Required. :type source_control_name: str + :param x_ms_github_auxiliary: Github personal access token used for SourceControl. Default + value is None. + :type x_ms_github_auxiliary: str + :param ignore_workflow_deletion_failure: Ignore Workflow Deletion Failure. Default value is + None. + :type ignore_workflow_deletion_failure: bool + :param delete_workflow: Delete workflow. Default value is None. + :type delete_workflow: bool :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -513,6 +552,9 @@ async def begin_delete( resource_group_name=resource_group_name, container_app_name=container_app_name, source_control_name=source_control_name, + x_ms_github_auxiliary=x_ms_github_auxiliary, + ignore_workflow_deletion_failure=ignore_workflow_deletion_failure, + delete_workflow=delete_workflow, api_version=api_version, cls=lambda x, y, z: x, headers=_headers, diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_dapr_component_resiliency_policies_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_dapr_component_resiliency_policies_operations.py new file mode 100644 index 000000000000..83bef2cb2959 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_dapr_component_resiliency_policies_operations.py @@ -0,0 +1,444 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ...operations._dapr_component_resiliency_policies_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class DaprComponentResiliencyPoliciesOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.aio.ContainerAppsAPIClient`'s + :attr:`dapr_component_resiliency_policies` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, resource_group_name: str, environment_name: str, component_name: str, **kwargs: Any + ) -> AsyncIterable["_models.DaprComponentResiliencyPolicy"]: + """Get the resiliency policies for a Dapr component. + + Get the resiliency policies for a Dapr component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param component_name: Name of the Dapr Component. Required. + :type component_name: str + :return: An iterator like instance of either DaprComponentResiliencyPolicy or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicy] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DaprComponentResiliencyPoliciesCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + component_name=component_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("DaprComponentResiliencyPoliciesCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get( + self, resource_group_name: str, environment_name: str, component_name: str, name: str, **kwargs: Any + ) -> _models.DaprComponentResiliencyPolicy: + """Get a Dapr component resiliency policy. + + Get a Dapr component resiliency policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param component_name: Name of the Dapr Component. Required. + :type component_name: str + :param name: Name of the Dapr Component Resiliency Policy. Required. + :type name: str + :return: DaprComponentResiliencyPolicy or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DaprComponentResiliencyPolicy] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + component_name=component_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("DaprComponentResiliencyPolicy", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def create_or_update( + self, + resource_group_name: str, + environment_name: str, + component_name: str, + name: str, + dapr_component_resiliency_policy_envelope: _models.DaprComponentResiliencyPolicy, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DaprComponentResiliencyPolicy: + """Creates or updates a Dapr component resiliency policy. + + Creates or updates a resiliency policy for a Dapr component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param component_name: Name of the Dapr Component. Required. + :type component_name: str + :param name: Name of the Dapr Component Resiliency Policy. Required. + :type name: str + :param dapr_component_resiliency_policy_envelope: Configuration details of the Dapr Component + Resiliency Policy. Required. + :type dapr_component_resiliency_policy_envelope: + ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicy + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: DaprComponentResiliencyPolicy or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + environment_name: str, + component_name: str, + name: str, + dapr_component_resiliency_policy_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DaprComponentResiliencyPolicy: + """Creates or updates a Dapr component resiliency policy. + + Creates or updates a resiliency policy for a Dapr component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param component_name: Name of the Dapr Component. Required. + :type component_name: str + :param name: Name of the Dapr Component Resiliency Policy. Required. + :type name: str + :param dapr_component_resiliency_policy_envelope: Configuration details of the Dapr Component + Resiliency Policy. Required. + :type dapr_component_resiliency_policy_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: DaprComponentResiliencyPolicy or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + environment_name: str, + component_name: str, + name: str, + dapr_component_resiliency_policy_envelope: Union[_models.DaprComponentResiliencyPolicy, IO[bytes]], + **kwargs: Any + ) -> _models.DaprComponentResiliencyPolicy: + """Creates or updates a Dapr component resiliency policy. + + Creates or updates a resiliency policy for a Dapr component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param component_name: Name of the Dapr Component. Required. + :type component_name: str + :param name: Name of the Dapr Component Resiliency Policy. Required. + :type name: str + :param dapr_component_resiliency_policy_envelope: Configuration details of the Dapr Component + Resiliency Policy. Is either a DaprComponentResiliencyPolicy type or a IO[bytes] type. + Required. + :type dapr_component_resiliency_policy_envelope: + ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicy or IO[bytes] + :return: DaprComponentResiliencyPolicy or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DaprComponentResiliencyPolicy] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(dapr_component_resiliency_policy_envelope, (IOBase, bytes)): + _content = dapr_component_resiliency_policy_envelope + else: + _json = self._serialize.body(dapr_component_resiliency_policy_envelope, "DaprComponentResiliencyPolicy") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + component_name=component_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("DaprComponentResiliencyPolicy", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, environment_name: str, component_name: str, name: str, **kwargs: Any + ) -> None: + """Delete a Dapr component resiliency policy. + + Delete a resiliency policy for a Dapr component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param component_name: Name of the Dapr Component. Required. + :type component_name: str + :param name: Name of the Dapr Component Resiliency Policy. Required. + :type name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + component_name=component_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_dapr_components_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_dapr_components_operations.py index 8af3e37345a3..000354f1d838 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_dapr_components_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_dapr_components_operations.py @@ -35,7 +35,6 @@ build_list_request, build_list_secrets_request, ) -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_dapr_subscriptions_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_dapr_subscriptions_operations.py new file mode 100644 index 000000000000..6f92d52e2b97 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_dapr_subscriptions_operations.py @@ -0,0 +1,420 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ...operations._dapr_subscriptions_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class DaprSubscriptionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.aio.ContainerAppsAPIClient`'s + :attr:`dapr_subscriptions` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, resource_group_name: str, environment_name: str, **kwargs: Any + ) -> AsyncIterable["_models.DaprSubscription"]: + """Get the Dapr subscriptions for a managed environment. + + Get the Dapr subscriptions for a managed environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :return: An iterator like instance of either DaprSubscription or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.DaprSubscription] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DaprSubscriptionsCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("DaprSubscriptionsCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get( + self, resource_group_name: str, environment_name: str, name: str, **kwargs: Any + ) -> _models.DaprSubscription: + """Get a dapr subscription. + + Get a dapr subscription. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the Dapr subscription. Required. + :type name: str + :return: DaprSubscription or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.DaprSubscription + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DaprSubscription] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("DaprSubscription", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def create_or_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + dapr_subscription_envelope: _models.DaprSubscription, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DaprSubscription: + """Creates or updates a Dapr subscription. + + Creates or updates a Dapr subscription in a Managed Environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the Dapr subscription. Required. + :type name: str + :param dapr_subscription_envelope: Configuration details of the Dapr subscription. Required. + :type dapr_subscription_envelope: ~azure.mgmt.appcontainers.models.DaprSubscription + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: DaprSubscription or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.DaprSubscription + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + dapr_subscription_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DaprSubscription: + """Creates or updates a Dapr subscription. + + Creates or updates a Dapr subscription in a Managed Environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the Dapr subscription. Required. + :type name: str + :param dapr_subscription_envelope: Configuration details of the Dapr subscription. Required. + :type dapr_subscription_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: DaprSubscription or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.DaprSubscription + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + dapr_subscription_envelope: Union[_models.DaprSubscription, IO[bytes]], + **kwargs: Any + ) -> _models.DaprSubscription: + """Creates or updates a Dapr subscription. + + Creates or updates a Dapr subscription in a Managed Environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the Dapr subscription. Required. + :type name: str + :param dapr_subscription_envelope: Configuration details of the Dapr subscription. Is either a + DaprSubscription type or a IO[bytes] type. Required. + :type dapr_subscription_envelope: ~azure.mgmt.appcontainers.models.DaprSubscription or + IO[bytes] + :return: DaprSubscription or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.DaprSubscription + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DaprSubscription] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(dapr_subscription_envelope, (IOBase, bytes)): + _content = dapr_subscription_envelope + else: + _json = self._serialize.body(dapr_subscription_envelope, "DaprSubscription") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("DaprSubscription", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, environment_name: str, name: str, **kwargs: Any + ) -> None: + """Delete a Dapr subscription. + + Delete a Dapr subscription from a Managed Environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the Dapr subscription. Required. + :type name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_dot_net_components_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_dot_net_components_operations.py new file mode 100644 index 000000000000..cbf95800c59a --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_dot_net_components_operations.py @@ -0,0 +1,765 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ...operations._dot_net_components_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, + build_update_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class DotNetComponentsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.aio.ContainerAppsAPIClient`'s + :attr:`dot_net_components` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, resource_group_name: str, environment_name: str, **kwargs: Any + ) -> AsyncIterable["_models.DotNetComponent"]: + """Get the .NET Components for a managed environment. + + Get the .NET Components for a managed environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :return: An iterator like instance of either DotNetComponent or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.DotNetComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DotNetComponentsCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("DotNetComponentsCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get( + self, resource_group_name: str, environment_name: str, name: str, **kwargs: Any + ) -> _models.DotNetComponent: + """Get a .NET Component. + + Get a .NET Component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the .NET Component. Required. + :type name: str + :return: DotNetComponent or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.DotNetComponent + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DotNetComponent] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("DotNetComponent", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + environment_name: str, + name: str, + dot_net_component_envelope: Union[_models.DotNetComponent, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(dot_net_component_envelope, (IOBase, bytes)): + _content = dot_net_component_envelope + else: + _json = self._serialize.body(dot_net_component_envelope, "DotNetComponent") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + dot_net_component_envelope: _models.DotNetComponent, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.DotNetComponent]: + """Creates or updates a .NET Component. + + Creates or updates a .NET Component in a Managed Environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the .NET Component. Required. + :type name: str + :param dot_net_component_envelope: Configuration details of the .NET Component. Required. + :type dot_net_component_envelope: ~azure.mgmt.appcontainers.models.DotNetComponent + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either DotNetComponent or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.DotNetComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + dot_net_component_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.DotNetComponent]: + """Creates or updates a .NET Component. + + Creates or updates a .NET Component in a Managed Environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the .NET Component. Required. + :type name: str + :param dot_net_component_envelope: Configuration details of the .NET Component. Required. + :type dot_net_component_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either DotNetComponent or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.DotNetComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + dot_net_component_envelope: Union[_models.DotNetComponent, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.DotNetComponent]: + """Creates or updates a .NET Component. + + Creates or updates a .NET Component in a Managed Environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the .NET Component. Required. + :type name: str + :param dot_net_component_envelope: Configuration details of the .NET Component. Is either a + DotNetComponent type or a IO[bytes] type. Required. + :type dot_net_component_envelope: ~azure.mgmt.appcontainers.models.DotNetComponent or IO[bytes] + :return: An instance of AsyncLROPoller that returns either DotNetComponent or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.DotNetComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DotNetComponent] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + dot_net_component_envelope=dot_net_component_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("DotNetComponent", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.DotNetComponent].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.DotNetComponent]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _update_initial( + self, + resource_group_name: str, + environment_name: str, + name: str, + dot_net_component_envelope: Union[_models.DotNetComponent, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(dot_net_component_envelope, (IOBase, bytes)): + _content = dot_net_component_envelope + else: + _json = self._serialize.body(dot_net_component_envelope, "DotNetComponent") + + _request = build_update_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + dot_net_component_envelope: _models.DotNetComponent, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.DotNetComponent]: + """Update properties of a .NET Component. + + Patches a .NET Component using JSON Merge Patch. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the .NET Component. Required. + :type name: str + :param dot_net_component_envelope: Configuration details of the .NET Component. Required. + :type dot_net_component_envelope: ~azure.mgmt.appcontainers.models.DotNetComponent + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either DotNetComponent or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.DotNetComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + dot_net_component_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.DotNetComponent]: + """Update properties of a .NET Component. + + Patches a .NET Component using JSON Merge Patch. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the .NET Component. Required. + :type name: str + :param dot_net_component_envelope: Configuration details of the .NET Component. Required. + :type dot_net_component_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either DotNetComponent or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.DotNetComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + dot_net_component_envelope: Union[_models.DotNetComponent, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.DotNetComponent]: + """Update properties of a .NET Component. + + Patches a .NET Component using JSON Merge Patch. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the .NET Component. Required. + :type name: str + :param dot_net_component_envelope: Configuration details of the .NET Component. Is either a + DotNetComponent type or a IO[bytes] type. Required. + :type dot_net_component_envelope: ~azure.mgmt.appcontainers.models.DotNetComponent or IO[bytes] + :return: An instance of AsyncLROPoller that returns either DotNetComponent or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.DotNetComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DotNetComponent] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + dot_net_component_envelope=dot_net_component_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("DotNetComponent", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.DotNetComponent].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.DotNetComponent]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, resource_group_name: str, environment_name: str, name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, environment_name: str, name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a .NET Component. + + Delete a .NET Component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the .NET Component. Required. + :type name: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_functions_extension_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_functions_extension_operations.py new file mode 100644 index 000000000000..5842f2f55257 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_functions_extension_operations.py @@ -0,0 +1,125 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ...operations._functions_extension_operations import build_invoke_functions_host_request + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class FunctionsExtensionOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.aio.ContainerAppsAPIClient`'s + :attr:`functions_extension` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def invoke_functions_host( + self, + resource_group_name: str, + container_app_name: str, + revision_name: str, + function_app_name: str, + **kwargs: Any + ) -> str: + """Proxies a Functions host call to the function app backed by the container app. + + Proxies a Functions host call to the function app backed by the container app. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param revision_name: Name of the Container App Revision, the parent resource. Required. + :type revision_name: str + :param function_app_name: Name of the Function App, the extension resource. Required. + :type function_app_name: str + :return: str or the result of cls(response) + :rtype: str + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[str] = kwargs.pop("cls", None) + + _request = build_invoke_functions_host_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + revision_name=revision_name, + function_app_name=function_app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("str", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_java_components_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_java_components_operations.py new file mode 100644 index 000000000000..ade6507b432b --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_java_components_operations.py @@ -0,0 +1,764 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ...operations._java_components_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, + build_update_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class JavaComponentsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.aio.ContainerAppsAPIClient`'s + :attr:`java_components` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, resource_group_name: str, environment_name: str, **kwargs: Any + ) -> AsyncIterable["_models.JavaComponent"]: + """Get the Java Components for a managed environment. + + Get the Java Components for a managed environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :return: An iterator like instance of either JavaComponent or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.JavaComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.JavaComponentsCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("JavaComponentsCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get( + self, resource_group_name: str, environment_name: str, name: str, **kwargs: Any + ) -> _models.JavaComponent: + """Get a Java Component. + + Get a Java Component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the Java Component. Required. + :type name: str + :return: JavaComponent or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.JavaComponent + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.JavaComponent] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("JavaComponent", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + environment_name: str, + name: str, + java_component_envelope: Union[_models.JavaComponent, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(java_component_envelope, (IOBase, bytes)): + _content = java_component_envelope + else: + _json = self._serialize.body(java_component_envelope, "JavaComponent") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + java_component_envelope: _models.JavaComponent, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.JavaComponent]: + """Creates or updates a Java Component. + + Creates or updates a Java Component in a Managed Environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the Java Component. Required. + :type name: str + :param java_component_envelope: Configuration details of the Java Component. Required. + :type java_component_envelope: ~azure.mgmt.appcontainers.models.JavaComponent + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either JavaComponent or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.JavaComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + java_component_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.JavaComponent]: + """Creates or updates a Java Component. + + Creates or updates a Java Component in a Managed Environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the Java Component. Required. + :type name: str + :param java_component_envelope: Configuration details of the Java Component. Required. + :type java_component_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either JavaComponent or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.JavaComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + java_component_envelope: Union[_models.JavaComponent, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.JavaComponent]: + """Creates or updates a Java Component. + + Creates or updates a Java Component in a Managed Environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the Java Component. Required. + :type name: str + :param java_component_envelope: Configuration details of the Java Component. Is either a + JavaComponent type or a IO[bytes] type. Required. + :type java_component_envelope: ~azure.mgmt.appcontainers.models.JavaComponent or IO[bytes] + :return: An instance of AsyncLROPoller that returns either JavaComponent or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.JavaComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.JavaComponent] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + java_component_envelope=java_component_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("JavaComponent", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.JavaComponent].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.JavaComponent]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _update_initial( + self, + resource_group_name: str, + environment_name: str, + name: str, + java_component_envelope: Union[_models.JavaComponent, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(java_component_envelope, (IOBase, bytes)): + _content = java_component_envelope + else: + _json = self._serialize.body(java_component_envelope, "JavaComponent") + + _request = build_update_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + java_component_envelope: _models.JavaComponent, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.JavaComponent]: + """Update properties of a Java Component. + + Patches a Java Component using JSON Merge Patch. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the Java Component. Required. + :type name: str + :param java_component_envelope: Configuration details of the Java Component. Required. + :type java_component_envelope: ~azure.mgmt.appcontainers.models.JavaComponent + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either JavaComponent or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.JavaComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + java_component_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.JavaComponent]: + """Update properties of a Java Component. + + Patches a Java Component using JSON Merge Patch. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the Java Component. Required. + :type name: str + :param java_component_envelope: Configuration details of the Java Component. Required. + :type java_component_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either JavaComponent or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.JavaComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + java_component_envelope: Union[_models.JavaComponent, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.JavaComponent]: + """Update properties of a Java Component. + + Patches a Java Component using JSON Merge Patch. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the Java Component. Required. + :type name: str + :param java_component_envelope: Configuration details of the Java Component. Is either a + JavaComponent type or a IO[bytes] type. Required. + :type java_component_envelope: ~azure.mgmt.appcontainers.models.JavaComponent or IO[bytes] + :return: An instance of AsyncLROPoller that returns either JavaComponent or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.JavaComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.JavaComponent] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + java_component_envelope=java_component_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("JavaComponent", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.JavaComponent].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.JavaComponent]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, resource_group_name: str, environment_name: str, name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, environment_name: str, name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a Java Component. + + Delete a Java Component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the Java Component. Required. + :type name: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_jobs_executions_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_jobs_executions_operations.py index 315e67ddf9b2..c261a646f9a7 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_jobs_executions_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_jobs_executions_operations.py @@ -27,7 +27,6 @@ from ... import models as _models from ...operations._jobs_executions_operations import build_list_request -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_jobs_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_jobs_operations.py index b6fa273f0f71..1a9c1c601aa5 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_jobs_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_jobs_operations.py @@ -42,12 +42,13 @@ build_list_detectors_request, build_list_secrets_request, build_proxy_get_request, + build_resume_request, build_start_request, build_stop_execution_request, build_stop_multiple_executions_request, + build_suspend_request, build_update_request, ) -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -57,7 +58,7 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class JobsOperations: +class JobsOperations: # pylint: disable=too-many-public-methods """ .. warning:: **DO NOT** instantiate this class directly. @@ -227,7 +228,7 @@ async def get_detector( @distributed_trace_async async def proxy_get(self, resource_group_name: str, job_name: str, api_name: str, **kwargs: Any) -> _models.Job: - """Get the properties of a Container App Job. + """Get the properties for a given Container App Job. Get the properties of a Container App Job. @@ -1508,3 +1509,241 @@ async def list_secrets( return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore + + async def _resume_initial(self, resource_group_name: str, job_name: str, **kwargs: Any) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_resume_request( + resource_group_name=resource_group_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_resume(self, resource_group_name: str, job_name: str, **kwargs: Any) -> AsyncLROPoller[_models.Job]: + """Resumes a suspended job. + + Resumes a suspended job. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param job_name: Name of the Job. Required. + :type job_name: str + :return: An instance of AsyncLROPoller that returns either Job or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.Job] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Job] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._resume_initial( + resource_group_name=resource_group_name, + job_name=job_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Job", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.Job].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.Job]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _suspend_initial(self, resource_group_name: str, job_name: str, **kwargs: Any) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_suspend_request( + resource_group_name=resource_group_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_suspend( + self, resource_group_name: str, job_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.Job]: + """Suspends a job. + + Suspends a job. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param job_name: Name of the Job. Required. + :type job_name: str + :return: An instance of AsyncLROPoller that returns either Job or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.Job] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Job] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._suspend_initial( + resource_group_name=resource_group_name, + job_name=job_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Job", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.Job].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.Job]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_logic_apps_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_logic_apps_operations.py new file mode 100644 index 000000000000..cc823a950fa5 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_logic_apps_operations.py @@ -0,0 +1,767 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ...operations._logic_apps_operations import ( + build_create_or_update_request, + build_delete_request, + build_deploy_workflow_artifacts_request, + build_get_request, + build_get_workflow_request, + build_invoke_request, + build_list_workflows_connections_request, + build_list_workflows_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class LogicAppsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.aio.ContainerAppsAPIClient`'s + :attr:`logic_apps` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, resource_group_name: str, container_app_name: str, logic_app_name: str, **kwargs: Any + ) -> _models.LogicApp: + """Gets a logic app extension resource. + + Gets a logic app extension resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param logic_app_name: Name of the Logic App, the extension resource. Required. + :type logic_app_name: str + :return: LogicApp or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.LogicApp + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.LogicApp] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + logic_app_name=logic_app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("LogicApp", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def create_or_update( + self, + resource_group_name: str, + container_app_name: str, + logic_app_name: str, + resource: _models.LogicApp, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.LogicApp: + """Create or update a Logic App extension resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param logic_app_name: Name of the Logic App, the extension resource. Required. + :type logic_app_name: str + :param resource: Logic app resource properties. Required. + :type resource: ~azure.mgmt.appcontainers.models.LogicApp + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: LogicApp or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.LogicApp + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + container_app_name: str, + logic_app_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.LogicApp: + """Create or update a Logic App extension resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param logic_app_name: Name of the Logic App, the extension resource. Required. + :type logic_app_name: str + :param resource: Logic app resource properties. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: LogicApp or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.LogicApp + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + container_app_name: str, + logic_app_name: str, + resource: Union[_models.LogicApp, IO[bytes]], + **kwargs: Any + ) -> _models.LogicApp: + """Create or update a Logic App extension resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param logic_app_name: Name of the Logic App, the extension resource. Required. + :type logic_app_name: str + :param resource: Logic app resource properties. Is either a LogicApp type or a IO[bytes] type. + Required. + :type resource: ~azure.mgmt.appcontainers.models.LogicApp or IO[bytes] + :return: LogicApp or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.LogicApp + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.LogicApp] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "LogicApp") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + logic_app_name=logic_app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("LogicApp", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, container_app_name: str, logic_app_name: str, **kwargs: Any + ) -> None: + """Deletes a Logic App extension resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param logic_app_name: Name of the Logic App, the extension resource. Required. + :type logic_app_name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + logic_app_name=logic_app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list_workflows( + self, resource_group_name: str, container_app_name: str, logic_app_name: str, **kwargs: Any + ) -> AsyncIterable["_models.WorkflowEnvelope"]: + """List the workflows for a logic app. + + List the workflows for a logic app. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param logic_app_name: Name of the Logic App, the extension resource. Required. + :type logic_app_name: str + :return: An iterator like instance of either WorkflowEnvelope or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.WorkflowEnvelope] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.WorkflowEnvelopeCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_workflows_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + logic_app_name=logic_app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("WorkflowEnvelopeCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get_workflow( + self, resource_group_name: str, container_app_name: str, logic_app_name: str, workflow_name: str, **kwargs: Any + ) -> _models.WorkflowEnvelope: + """Get workflow information by its name. + + Get workflow information by its name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param logic_app_name: Name of the Logic App, the extension resource. Required. + :type logic_app_name: str + :param workflow_name: Workflow name. Required. + :type workflow_name: str + :return: WorkflowEnvelope or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.WorkflowEnvelope + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.WorkflowEnvelope] = kwargs.pop("cls", None) + + _request = build_get_workflow_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + logic_app_name=logic_app_name, + workflow_name=workflow_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("WorkflowEnvelope", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def deploy_workflow_artifacts( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + container_app_name: str, + logic_app_name: str, + workflow_artifacts: Optional[_models.WorkflowArtifacts] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Creates or updates the artifacts for the logic app. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param logic_app_name: Name of the Logic App, the extension resource. Required. + :type logic_app_name: str + :param workflow_artifacts: Application settings and files of the workflow. Default value is + None. + :type workflow_artifacts: ~azure.mgmt.appcontainers.models.WorkflowArtifacts + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def deploy_workflow_artifacts( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + container_app_name: str, + logic_app_name: str, + workflow_artifacts: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Creates or updates the artifacts for the logic app. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param logic_app_name: Name of the Logic App, the extension resource. Required. + :type logic_app_name: str + :param workflow_artifacts: Application settings and files of the workflow. Default value is + None. + :type workflow_artifacts: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def deploy_workflow_artifacts( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + container_app_name: str, + logic_app_name: str, + workflow_artifacts: Optional[Union[_models.WorkflowArtifacts, IO[bytes]]] = None, + **kwargs: Any + ) -> None: + """Creates or updates the artifacts for the logic app. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param logic_app_name: Name of the Logic App, the extension resource. Required. + :type logic_app_name: str + :param workflow_artifacts: Application settings and files of the workflow. Is either a + WorkflowArtifacts type or a IO[bytes] type. Default value is None. + :type workflow_artifacts: ~azure.mgmt.appcontainers.models.WorkflowArtifacts or IO[bytes] + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(workflow_artifacts, (IOBase, bytes)): + _content = workflow_artifacts + else: + if workflow_artifacts is not None: + _json = self._serialize.body(workflow_artifacts, "WorkflowArtifacts") + else: + _json = None + + _request = build_deploy_workflow_artifacts_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + logic_app_name=logic_app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace_async + async def list_workflows_connections( + self, resource_group_name: str, container_app_name: str, logic_app_name: str, **kwargs: Any + ) -> _models.WorkflowEnvelope: + """Gets logic app's connections. + + Gets logic app's connections. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param logic_app_name: Name of the Logic App, the extension resource. Required. + :type logic_app_name: str + :return: WorkflowEnvelope or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.WorkflowEnvelope + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.WorkflowEnvelope] = kwargs.pop("cls", None) + + _request = build_list_workflows_connections_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + logic_app_name=logic_app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("WorkflowEnvelope", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def invoke( + self, + resource_group_name: str, + container_app_name: str, + logic_app_name: str, + x_ms_logic_apps_proxy_path: str, + x_ms_logic_apps_proxy_method: Union[str, _models.LogicAppsProxyMethod], + **kwargs: Any + ) -> JSON: + """Proxies a the API call to the logic app backed by the container app. + + Proxies a the API call to the logic app backed by the container app. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param logic_app_name: Name of the LogicApp App, the extension resource. Required. + :type logic_app_name: str + :param x_ms_logic_apps_proxy_path: The proxy path for the API call. Required. + :type x_ms_logic_apps_proxy_path: str + :param x_ms_logic_apps_proxy_method: The proxy method for the API call. Known values are: "GET" + and "POST". Required. + :type x_ms_logic_apps_proxy_method: str or + ~azure.mgmt.appcontainers.models.LogicAppsProxyMethod + :return: JSON or the result of cls(response) + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[JSON] = kwargs.pop("cls", None) + + _request = build_invoke_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + logic_app_name=logic_app_name, + subscription_id=self._config.subscription_id, + x_ms_logic_apps_proxy_path=x_ms_logic_apps_proxy_path, + x_ms_logic_apps_proxy_method=x_ms_logic_apps_proxy_method, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("object", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_certificates_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_certificates_operations.py index 48dd8d1cb147..39cff80465ea 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_certificates_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_certificates_operations.py @@ -39,7 +39,6 @@ build_list_request, build_update_request, ) -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environment_diagnostics_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environment_diagnostics_operations.py index f7d05ad4b0fc..a2b62113b50a 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environment_diagnostics_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environment_diagnostics_operations.py @@ -28,7 +28,6 @@ build_get_detector_request, build_list_detectors_request, ) -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environment_private_endpoint_connections_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environment_private_endpoint_connections_operations.py new file mode 100644 index 000000000000..c90077c27e4f --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environment_private_endpoint_connections_operations.py @@ -0,0 +1,557 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ...operations._managed_environment_private_endpoint_connections_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ManagedEnvironmentPrivateEndpointConnectionsOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.aio.ContainerAppsAPIClient`'s + :attr:`managed_environment_private_endpoint_connections` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, resource_group_name: str, environment_name: str, **kwargs: Any + ) -> AsyncIterable["_models.PrivateEndpointConnection"]: + """List private endpoint connections for a given managed environment. + + List private endpoint connections for a given managed environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :return: An iterator like instance of either PrivateEndpointConnection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get( + self, resource_group_name: str, environment_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Get a private endpoint connection for a given managed environment. + + Get a private endpoint connection for a given managed environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. Required. + :type private_endpoint_connection_name: str + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + environment_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection_envelope: Union[_models.PrivateEndpointConnection, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(private_endpoint_connection_envelope, (IOBase, bytes)): + _content = private_endpoint_connection_envelope + else: + _json = self._serialize.body(private_endpoint_connection_envelope, "PrivateEndpointConnection") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + environment_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection_envelope: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PrivateEndpointConnection]: + """Update the state of a private endpoint connection for a given managed environment. + + Update the state of a private endpoint connection for a given managed environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. Required. + :type private_endpoint_connection_name: str + :param private_endpoint_connection_envelope: The resource of private endpoint and its + properties. Required. + :type private_endpoint_connection_envelope: + ~azure.mgmt.appcontainers.models.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + environment_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PrivateEndpointConnection]: + """Update the state of a private endpoint connection for a given managed environment. + + Update the state of a private endpoint connection for a given managed environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. Required. + :type private_endpoint_connection_name: str + :param private_endpoint_connection_envelope: The resource of private endpoint and its + properties. Required. + :type private_endpoint_connection_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + environment_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection_envelope: Union[_models.PrivateEndpointConnection, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.PrivateEndpointConnection]: + """Update the state of a private endpoint connection for a given managed environment. + + Update the state of a private endpoint connection for a given managed environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. Required. + :type private_endpoint_connection_name: str + :param private_endpoint_connection_envelope: The resource of private endpoint and its + properties. Is either a PrivateEndpointConnection type or a IO[bytes] type. Required. + :type private_endpoint_connection_envelope: + ~azure.mgmt.appcontainers.models.PrivateEndpointConnection or IO[bytes] + :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + environment_name=environment_name, + private_endpoint_connection_name=private_endpoint_connection_name, + private_endpoint_connection_envelope=private_endpoint_connection_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.PrivateEndpointConnection].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.PrivateEndpointConnection]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, resource_group_name: str, environment_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, environment_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a private endpoint connection for a given managed environment. + + Delete a private endpoint connection for a given managed environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. Required. + :type private_endpoint_connection_name: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + environment_name=environment_name, + private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environment_private_link_resources_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environment_private_link_resources_operations.py new file mode 100644 index 000000000000..59636be922d3 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environment_private_link_resources_operations.py @@ -0,0 +1,143 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ...operations._managed_environment_private_link_resources_operations import build_list_request + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ManagedEnvironmentPrivateLinkResourcesOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.aio.ContainerAppsAPIClient`'s + :attr:`managed_environment_private_link_resources` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, resource_group_name: str, environment_name: str, **kwargs: Any + ) -> AsyncIterable["_models.PrivateLinkResource"]: + """List private link resources for a given managed environment. + + List private link resources for a given managed environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :return: An iterator like instance of either PrivateLinkResource or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.PrivateLinkResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environment_usages_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environment_usages_operations.py index 32e5aba171df..f41521e7076b 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environment_usages_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environment_usages_operations.py @@ -27,7 +27,6 @@ from ... import models as _models from ...operations._managed_environment_usages_operations import build_list_request -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environments_diagnostics_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environments_diagnostics_operations.py index 72e6fae60a64..913445a2aa38 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environments_diagnostics_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environments_diagnostics_operations.py @@ -25,7 +25,6 @@ from ... import models as _models from ...operations._managed_environments_diagnostics_operations import build_get_root_request -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environments_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environments_operations.py index 7cec22ada4f3..58184362c225 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environments_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environments_operations.py @@ -42,7 +42,6 @@ build_list_workload_profile_states_request, build_update_request, ) -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environments_storages_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environments_storages_operations.py index 6cba2a4bde27..4df31389d777 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environments_storages_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environments_storages_operations.py @@ -31,7 +31,6 @@ build_get_request, build_list_request, ) -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_namespaces_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_namespaces_operations.py index cc4441b9b104..6c4b11ba1a03 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_namespaces_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_namespaces_operations.py @@ -26,7 +26,6 @@ from ... import models as _models from ...operations._namespaces_operations import build_check_name_availability_request -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_operations.py index eede32e9e752..05240797532c 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_operations.py @@ -27,7 +27,6 @@ from ... import models as _models from ...operations._operations import build_list_request -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_usages_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_usages_operations.py index be6430b54a7c..3cb70b68e447 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_usages_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_usages_operations.py @@ -27,7 +27,6 @@ from ... import models as _models from ...operations._usages_operations import build_list_request -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/models/__init__.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/models/__init__.py index 132ece90cb50..d6a2ce622d06 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/models/__init__.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/models/__init__.py @@ -8,8 +8,11 @@ from ._models_py3 import AllowedAudiencesValidation from ._models_py3 import AllowedPrincipals +from ._models_py3 import AppInsightsConfiguration from ._models_py3 import AppLogsConfiguration from ._models_py3 import AppRegistration +from ._models_py3 import AppResiliency +from ._models_py3 import AppResiliencyCollection from ._models_py3 import Apple from ._models_py3 import AppleRegistration from ._models_py3 import AuthConfig @@ -32,12 +35,21 @@ from ._models_py3 import BillingMeterCollection from ._models_py3 import BillingMeterProperties from ._models_py3 import BlobStorageTokenStore +from ._models_py3 import BuildCollection +from ._models_py3 import BuildConfiguration +from ._models_py3 import BuildResource +from ._models_py3 import BuildToken +from ._models_py3 import BuilderCollection +from ._models_py3 import BuilderResource +from ._models_py3 import BuilderResourceUpdate from ._models_py3 import Certificate from ._models_py3 import CertificateCollection +from ._models_py3 import CertificateKeyVaultProperties from ._models_py3 import CertificatePatch from ._models_py3 import CertificateProperties from ._models_py3 import CheckNameAvailabilityRequest from ._models_py3 import CheckNameAvailabilityResponse +from ._models_py3 import CircuitBreakerPolicy from ._models_py3 import ClientRegistration from ._models_py3 import Configuration from ._models_py3 import ConnectedEnvironment @@ -54,10 +66,19 @@ from ._models_py3 import ContainerAppProbeHttpGet from ._models_py3 import ContainerAppProbeHttpGetHttpHeadersItem from ._models_py3 import ContainerAppProbeTcpSocket +from ._models_py3 import ContainerAppPropertiesPatchingConfiguration from ._models_py3 import ContainerAppSecret +from ._models_py3 import ContainerAppsBuildCollection +from ._models_py3 import ContainerAppsBuildConfiguration +from ._models_py3 import ContainerAppsBuildResource +from ._models_py3 import ContainerAppsPatchResource +from ._models_py3 import ContainerExecutionStatus +from ._models_py3 import ContainerRegistry +from ._models_py3 import ContainerRegistryWithCustomImage from ._models_py3 import ContainerResources from ._models_py3 import CookieExpiration from ._models_py3 import CorsPolicy +from ._models_py3 import CustomContainerTemplate from ._models_py3 import CustomDomain from ._models_py3 import CustomDomainConfiguration from ._models_py3 import CustomHostnameAnalysisResult @@ -67,15 +88,31 @@ from ._models_py3 import CustomScaleRule from ._models_py3 import Dapr from ._models_py3 import DaprComponent +from ._models_py3 import DaprComponentResiliencyPoliciesCollection +from ._models_py3 import DaprComponentResiliencyPolicy +from ._models_py3 import DaprComponentResiliencyPolicyCircuitBreakerPolicyConfiguration +from ._models_py3 import DaprComponentResiliencyPolicyConfiguration +from ._models_py3 import DaprComponentResiliencyPolicyHttpRetryBackOffConfiguration +from ._models_py3 import DaprComponentResiliencyPolicyHttpRetryPolicyConfiguration +from ._models_py3 import DaprComponentResiliencyPolicyTimeoutPolicyConfiguration +from ._models_py3 import DaprComponentServiceBinding from ._models_py3 import DaprComponentsCollection from ._models_py3 import DaprConfiguration from ._models_py3 import DaprMetadata from ._models_py3 import DaprSecret from ._models_py3 import DaprSecretsCollection +from ._models_py3 import DaprServiceBindMetadata +from ._models_py3 import DaprSubscription +from ._models_py3 import DaprSubscriptionBulkSubscribeOptions +from ._models_py3 import DaprSubscriptionRouteRule +from ._models_py3 import DaprSubscriptionRoutes +from ._models_py3 import DaprSubscriptionsCollection +from ._models_py3 import DataDogConfiguration from ._models_py3 import DefaultAuthorizationPolicy from ._models_py3 import DefaultErrorResponse from ._models_py3 import DefaultErrorResponseError from ._models_py3 import DefaultErrorResponseErrorDetailsItem +from ._models_py3 import DestinationsConfiguration from ._models_py3 import DiagnosticDataProviderMetadata from ._models_py3 import DiagnosticDataProviderMetadataPropertyBagItem from ._models_py3 import DiagnosticDataTableResponseColumn @@ -88,12 +125,20 @@ from ._models_py3 import DiagnosticsDefinition from ._models_py3 import DiagnosticsProperties from ._models_py3 import DiagnosticsStatus +from ._models_py3 import DotNetComponent +from ._models_py3 import DotNetComponentConfigurationProperty +from ._models_py3 import DotNetComponentServiceBind +from ._models_py3 import DotNetComponentsCollection +from ._models_py3 import DynamicPoolConfiguration from ._models_py3 import EncryptionSettings from ._models_py3 import EnvironmentAuthToken from ._models_py3 import EnvironmentVar +from ._models_py3 import EnvironmentVariable from ._models_py3 import ErrorAdditionalInfo from ._models_py3 import ErrorDetail +from ._models_py3 import ErrorEntity from ._models_py3 import ErrorResponse +from ._models_py3 import ExecutionStatus from ._models_py3 import ExtendedLocation from ._models_py3 import Facebook from ._models_py3 import ForwardProxy @@ -101,15 +146,28 @@ from ._models_py3 import GithubActionConfiguration from ._models_py3 import GlobalValidation from ._models_py3 import Google +from ._models_py3 import Header +from ._models_py3 import HeaderMatch +from ._models_py3 import HttpConnectionPool +from ._models_py3 import HttpGet +from ._models_py3 import HttpRetryPolicy from ._models_py3 import HttpScaleRule from ._models_py3 import HttpSettings from ._models_py3 import HttpSettingsRoutes from ._models_py3 import IdentityProviders +from ._models_py3 import IdentitySettings from ._models_py3 import Ingress from ._models_py3 import IngressPortMapping from ._models_py3 import IngressStickySessions from ._models_py3 import InitContainer from ._models_py3 import IpSecurityRestrictionRule +from ._models_py3 import JavaComponent +from ._models_py3 import JavaComponentConfigurationProperty +from ._models_py3 import JavaComponentIngress +from ._models_py3 import JavaComponentProperties +from ._models_py3 import JavaComponentPropertiesScale +from ._models_py3 import JavaComponentServiceBind +from ._models_py3 import JavaComponentsCollection from ._models_py3 import Job from ._models_py3 import JobConfiguration from ._models_py3 import JobConfigurationEventTriggerConfig @@ -131,9 +189,12 @@ from ._models_py3 import KedaConfiguration from ._models_py3 import ListUsagesResult from ._models_py3 import LogAnalyticsConfiguration +from ._models_py3 import LoggerSetting +from ._models_py3 import LogicApp from ._models_py3 import Login from ._models_py3 import LoginRoutes from ._models_py3 import LoginScopes +from ._models_py3 import LogsConfiguration from ._models_py3 import ManagedCertificate from ._models_py3 import ManagedCertificateCollection from ._models_py3 import ManagedCertificatePatch @@ -147,14 +208,32 @@ from ._models_py3 import ManagedEnvironmentStoragesCollection from ._models_py3 import ManagedEnvironmentsCollection from ._models_py3 import ManagedServiceIdentity +from ._models_py3 import MetricsConfiguration from ._models_py3 import Mtls +from ._models_py3 import NacosComponent +from ._models_py3 import NfsAzureFileProperties from ._models_py3 import Nonce from ._models_py3 import OpenIdConnectClientCredential from ._models_py3 import OpenIdConnectConfig from ._models_py3 import OpenIdConnectLogin from ._models_py3 import OpenIdConnectRegistration +from ._models_py3 import OpenTelemetryConfiguration from ._models_py3 import OperationDetail from ._models_py3 import OperationDisplay +from ._models_py3 import OtlpConfiguration +from ._models_py3 import PatchCollection +from ._models_py3 import PatchDetails +from ._models_py3 import PatchDetailsNewLayer +from ._models_py3 import PatchDetailsOldLayer +from ._models_py3 import PatchProperties +from ._models_py3 import PatchSkipConfig +from ._models_py3 import PreBuildStep +from ._models_py3 import PrivateEndpoint +from ._models_py3 import PrivateEndpointConnection +from ._models_py3 import PrivateEndpointConnectionListResult +from ._models_py3 import PrivateLinkResource +from ._models_py3 import PrivateLinkResourceListResult +from ._models_py3 import PrivateLinkServiceConnectionState from ._models_py3 import ProxyResource from ._models_py3 import QueueScaleRule from ._models_py3 import RegistryCredentials @@ -162,23 +241,49 @@ from ._models_py3 import Replica from ._models_py3 import ReplicaCollection from ._models_py3 import ReplicaContainer +from ._models_py3 import ReplicaExecutionStatus from ._models_py3 import Resource from ._models_py3 import Revision from ._models_py3 import RevisionCollection +from ._models_py3 import Runtime +from ._models_py3 import RuntimeDotnet +from ._models_py3 import RuntimeJava +from ._models_py3 import RuntimeJavaAgent +from ._models_py3 import RuntimeJavaAgentLogging from ._models_py3 import Scale +from ._models_py3 import ScaleConfiguration from ._models_py3 import ScaleRule from ._models_py3 import ScaleRuleAuth +from ._models_py3 import ScgRoute from ._models_py3 import Secret from ._models_py3 import SecretVolumeItem from ._models_py3 import SecretsCollection from ._models_py3 import Service from ._models_py3 import ServiceBind +from ._models_py3 import SessionContainer +from ._models_py3 import SessionContainerResources +from ._models_py3 import SessionIngress +from ._models_py3 import SessionNetworkConfiguration +from ._models_py3 import SessionPool +from ._models_py3 import SessionPoolCollection +from ._models_py3 import SessionPoolSecret +from ._models_py3 import SessionPoolUpdatableProperties +from ._models_py3 import SessionRegistryCredentials +from ._models_py3 import SmbStorage from ._models_py3 import SourceControl from ._models_py3 import SourceControlCollection +from ._models_py3 import SpringBootAdminComponent +from ._models_py3 import SpringCloudConfigComponent +from ._models_py3 import SpringCloudEurekaComponent +from ._models_py3 import SpringCloudGatewayComponent from ._models_py3 import SystemData +from ._models_py3 import TcpConnectionPool +from ._models_py3 import TcpRetryPolicy from ._models_py3 import TcpScaleRule from ._models_py3 import Template +from ._models_py3 import TimeoutPolicy from ._models_py3 import TokenStore +from ._models_py3 import TracesConfiguration from ._models_py3 import TrackedResource from ._models_py3 import TrafficWeight from ._models_py3 import Twitter @@ -189,6 +294,11 @@ from ._models_py3 import VnetConfiguration from ._models_py3 import Volume from ._models_py3 import VolumeMount +from ._models_py3 import WorkflowArtifacts +from ._models_py3 import WorkflowEnvelope +from ._models_py3 import WorkflowEnvelopeCollection +from ._models_py3 import WorkflowEnvelopeProperties +from ._models_py3 import WorkflowHealth from ._models_py3 import WorkloadProfile from ._models_py3 import WorkloadProfileStates from ._models_py3 import WorkloadProfileStatesCollection @@ -201,34 +311,63 @@ from ._container_apps_api_client_enums import AppProtocol from ._container_apps_api_client_enums import Applicability from ._container_apps_api_client_enums import BindingType +from ._container_apps_api_client_enums import BuildProvisioningState +from ._container_apps_api_client_enums import BuildStatus +from ._container_apps_api_client_enums import BuilderProvisioningState from ._container_apps_api_client_enums import CertificateProvisioningState +from ._container_apps_api_client_enums import CertificateType from ._container_apps_api_client_enums import CheckNameAvailabilityReason from ._container_apps_api_client_enums import ConnectedEnvironmentProvisioningState from ._container_apps_api_client_enums import ContainerAppContainerRunningState from ._container_apps_api_client_enums import ContainerAppProvisioningState from ._container_apps_api_client_enums import ContainerAppReplicaRunningState +from ._container_apps_api_client_enums import ContainerType from ._container_apps_api_client_enums import CookieExpirationConvention from ._container_apps_api_client_enums import CreatedByType +from ._container_apps_api_client_enums import DetectionStatus from ._container_apps_api_client_enums import DnsVerificationTestResult +from ._container_apps_api_client_enums import DotNetComponentProvisioningState +from ._container_apps_api_client_enums import DotNetComponentType from ._container_apps_api_client_enums import EnvironmentProvisioningState +from ._container_apps_api_client_enums import ExecutionType from ._container_apps_api_client_enums import ExtendedLocationTypes from ._container_apps_api_client_enums import ForwardProxyConvention +from ._container_apps_api_client_enums import IdentitySettingsLifeCycle +from ._container_apps_api_client_enums import ImageType from ._container_apps_api_client_enums import IngressClientCertificateMode +from ._container_apps_api_client_enums import IngressTargetPortHttpScheme from ._container_apps_api_client_enums import IngressTransportMethod +from ._container_apps_api_client_enums import JavaComponentProvisioningState +from ._container_apps_api_client_enums import JavaComponentType from ._container_apps_api_client_enums import JobExecutionRunningState from ._container_apps_api_client_enums import JobProvisioningState +from ._container_apps_api_client_enums import JobRunningState +from ._container_apps_api_client_enums import Kind +from ._container_apps_api_client_enums import Level from ._container_apps_api_client_enums import LogLevel +from ._container_apps_api_client_enums import LogicAppsProxyMethod from ._container_apps_api_client_enums import ManagedCertificateDomainControlValidation from ._container_apps_api_client_enums import ManagedServiceIdentityType +from ._container_apps_api_client_enums import PatchApplyStatus +from ._container_apps_api_client_enums import PatchType +from ._container_apps_api_client_enums import PatchingMode +from ._container_apps_api_client_enums import PoolManagementType +from ._container_apps_api_client_enums import PrivateEndpointConnectionProvisioningState +from ._container_apps_api_client_enums import PrivateEndpointServiceConnectionStatus +from ._container_apps_api_client_enums import PublicNetworkAccess from ._container_apps_api_client_enums import RevisionHealthState from ._container_apps_api_client_enums import RevisionProvisioningState from ._container_apps_api_client_enums import RevisionRunningState from ._container_apps_api_client_enums import Scheme +from ._container_apps_api_client_enums import SessionNetworkStatus +from ._container_apps_api_client_enums import SessionPoolProvisioningState from ._container_apps_api_client_enums import SourceControlOperationState from ._container_apps_api_client_enums import StorageType from ._container_apps_api_client_enums import TriggerType from ._container_apps_api_client_enums import Type from ._container_apps_api_client_enums import UnauthenticatedClientActionV2 +from ._container_apps_api_client_enums import WorkflowHealthState +from ._container_apps_api_client_enums import WorkflowState from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk @@ -236,8 +375,11 @@ __all__ = [ "AllowedAudiencesValidation", "AllowedPrincipals", + "AppInsightsConfiguration", "AppLogsConfiguration", "AppRegistration", + "AppResiliency", + "AppResiliencyCollection", "Apple", "AppleRegistration", "AuthConfig", @@ -260,12 +402,21 @@ "BillingMeterCollection", "BillingMeterProperties", "BlobStorageTokenStore", + "BuildCollection", + "BuildConfiguration", + "BuildResource", + "BuildToken", + "BuilderCollection", + "BuilderResource", + "BuilderResourceUpdate", "Certificate", "CertificateCollection", + "CertificateKeyVaultProperties", "CertificatePatch", "CertificateProperties", "CheckNameAvailabilityRequest", "CheckNameAvailabilityResponse", + "CircuitBreakerPolicy", "ClientRegistration", "Configuration", "ConnectedEnvironment", @@ -282,10 +433,19 @@ "ContainerAppProbeHttpGet", "ContainerAppProbeHttpGetHttpHeadersItem", "ContainerAppProbeTcpSocket", + "ContainerAppPropertiesPatchingConfiguration", "ContainerAppSecret", + "ContainerAppsBuildCollection", + "ContainerAppsBuildConfiguration", + "ContainerAppsBuildResource", + "ContainerAppsPatchResource", + "ContainerExecutionStatus", + "ContainerRegistry", + "ContainerRegistryWithCustomImage", "ContainerResources", "CookieExpiration", "CorsPolicy", + "CustomContainerTemplate", "CustomDomain", "CustomDomainConfiguration", "CustomHostnameAnalysisResult", @@ -295,15 +455,31 @@ "CustomScaleRule", "Dapr", "DaprComponent", + "DaprComponentResiliencyPoliciesCollection", + "DaprComponentResiliencyPolicy", + "DaprComponentResiliencyPolicyCircuitBreakerPolicyConfiguration", + "DaprComponentResiliencyPolicyConfiguration", + "DaprComponentResiliencyPolicyHttpRetryBackOffConfiguration", + "DaprComponentResiliencyPolicyHttpRetryPolicyConfiguration", + "DaprComponentResiliencyPolicyTimeoutPolicyConfiguration", + "DaprComponentServiceBinding", "DaprComponentsCollection", "DaprConfiguration", "DaprMetadata", "DaprSecret", "DaprSecretsCollection", + "DaprServiceBindMetadata", + "DaprSubscription", + "DaprSubscriptionBulkSubscribeOptions", + "DaprSubscriptionRouteRule", + "DaprSubscriptionRoutes", + "DaprSubscriptionsCollection", + "DataDogConfiguration", "DefaultAuthorizationPolicy", "DefaultErrorResponse", "DefaultErrorResponseError", "DefaultErrorResponseErrorDetailsItem", + "DestinationsConfiguration", "DiagnosticDataProviderMetadata", "DiagnosticDataProviderMetadataPropertyBagItem", "DiagnosticDataTableResponseColumn", @@ -316,12 +492,20 @@ "DiagnosticsDefinition", "DiagnosticsProperties", "DiagnosticsStatus", + "DotNetComponent", + "DotNetComponentConfigurationProperty", + "DotNetComponentServiceBind", + "DotNetComponentsCollection", + "DynamicPoolConfiguration", "EncryptionSettings", "EnvironmentAuthToken", "EnvironmentVar", + "EnvironmentVariable", "ErrorAdditionalInfo", "ErrorDetail", + "ErrorEntity", "ErrorResponse", + "ExecutionStatus", "ExtendedLocation", "Facebook", "ForwardProxy", @@ -329,15 +513,28 @@ "GithubActionConfiguration", "GlobalValidation", "Google", + "Header", + "HeaderMatch", + "HttpConnectionPool", + "HttpGet", + "HttpRetryPolicy", "HttpScaleRule", "HttpSettings", "HttpSettingsRoutes", "IdentityProviders", + "IdentitySettings", "Ingress", "IngressPortMapping", "IngressStickySessions", "InitContainer", "IpSecurityRestrictionRule", + "JavaComponent", + "JavaComponentConfigurationProperty", + "JavaComponentIngress", + "JavaComponentProperties", + "JavaComponentPropertiesScale", + "JavaComponentServiceBind", + "JavaComponentsCollection", "Job", "JobConfiguration", "JobConfigurationEventTriggerConfig", @@ -359,9 +556,12 @@ "KedaConfiguration", "ListUsagesResult", "LogAnalyticsConfiguration", + "LoggerSetting", + "LogicApp", "Login", "LoginRoutes", "LoginScopes", + "LogsConfiguration", "ManagedCertificate", "ManagedCertificateCollection", "ManagedCertificatePatch", @@ -375,14 +575,32 @@ "ManagedEnvironmentStoragesCollection", "ManagedEnvironmentsCollection", "ManagedServiceIdentity", + "MetricsConfiguration", "Mtls", + "NacosComponent", + "NfsAzureFileProperties", "Nonce", "OpenIdConnectClientCredential", "OpenIdConnectConfig", "OpenIdConnectLogin", "OpenIdConnectRegistration", + "OpenTelemetryConfiguration", "OperationDetail", "OperationDisplay", + "OtlpConfiguration", + "PatchCollection", + "PatchDetails", + "PatchDetailsNewLayer", + "PatchDetailsOldLayer", + "PatchProperties", + "PatchSkipConfig", + "PreBuildStep", + "PrivateEndpoint", + "PrivateEndpointConnection", + "PrivateEndpointConnectionListResult", + "PrivateLinkResource", + "PrivateLinkResourceListResult", + "PrivateLinkServiceConnectionState", "ProxyResource", "QueueScaleRule", "RegistryCredentials", @@ -390,23 +608,49 @@ "Replica", "ReplicaCollection", "ReplicaContainer", + "ReplicaExecutionStatus", "Resource", "Revision", "RevisionCollection", + "Runtime", + "RuntimeDotnet", + "RuntimeJava", + "RuntimeJavaAgent", + "RuntimeJavaAgentLogging", "Scale", + "ScaleConfiguration", "ScaleRule", "ScaleRuleAuth", + "ScgRoute", "Secret", "SecretVolumeItem", "SecretsCollection", "Service", "ServiceBind", + "SessionContainer", + "SessionContainerResources", + "SessionIngress", + "SessionNetworkConfiguration", + "SessionPool", + "SessionPoolCollection", + "SessionPoolSecret", + "SessionPoolUpdatableProperties", + "SessionRegistryCredentials", + "SmbStorage", "SourceControl", "SourceControlCollection", + "SpringBootAdminComponent", + "SpringCloudConfigComponent", + "SpringCloudEurekaComponent", + "SpringCloudGatewayComponent", "SystemData", + "TcpConnectionPool", + "TcpRetryPolicy", "TcpScaleRule", "Template", + "TimeoutPolicy", "TokenStore", + "TracesConfiguration", "TrackedResource", "TrafficWeight", "Twitter", @@ -417,6 +661,11 @@ "VnetConfiguration", "Volume", "VolumeMount", + "WorkflowArtifacts", + "WorkflowEnvelope", + "WorkflowEnvelopeCollection", + "WorkflowEnvelopeProperties", + "WorkflowHealth", "WorkloadProfile", "WorkloadProfileStates", "WorkloadProfileStatesCollection", @@ -428,34 +677,63 @@ "AppProtocol", "Applicability", "BindingType", + "BuildProvisioningState", + "BuildStatus", + "BuilderProvisioningState", "CertificateProvisioningState", + "CertificateType", "CheckNameAvailabilityReason", "ConnectedEnvironmentProvisioningState", "ContainerAppContainerRunningState", "ContainerAppProvisioningState", "ContainerAppReplicaRunningState", + "ContainerType", "CookieExpirationConvention", "CreatedByType", + "DetectionStatus", "DnsVerificationTestResult", + "DotNetComponentProvisioningState", + "DotNetComponentType", "EnvironmentProvisioningState", + "ExecutionType", "ExtendedLocationTypes", "ForwardProxyConvention", + "IdentitySettingsLifeCycle", + "ImageType", "IngressClientCertificateMode", + "IngressTargetPortHttpScheme", "IngressTransportMethod", + "JavaComponentProvisioningState", + "JavaComponentType", "JobExecutionRunningState", "JobProvisioningState", + "JobRunningState", + "Kind", + "Level", "LogLevel", + "LogicAppsProxyMethod", "ManagedCertificateDomainControlValidation", "ManagedServiceIdentityType", + "PatchApplyStatus", + "PatchType", + "PatchingMode", + "PoolManagementType", + "PrivateEndpointConnectionProvisioningState", + "PrivateEndpointServiceConnectionStatus", + "PublicNetworkAccess", "RevisionHealthState", "RevisionProvisioningState", "RevisionRunningState", "Scheme", + "SessionNetworkStatus", + "SessionPoolProvisioningState", "SourceControlOperationState", "StorageType", "TriggerType", "Type", "UnauthenticatedClientActionV2", + "WorkflowHealthState", + "WorkflowState", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/models/_container_apps_api_client_enums.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/models/_container_apps_api_client_enums.py index 694a6932ba5d..5466c525adcb 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/models/_container_apps_api_client_enums.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/models/_container_apps_api_client_enums.py @@ -71,6 +71,38 @@ class BindingType(str, Enum, metaclass=CaseInsensitiveEnumMeta): SNI_ENABLED = "SniEnabled" +class BuilderProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Resource instance provisioning state.""" + + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CANCELED = "Canceled" + CREATING = "Creating" + UPDATING = "Updating" + DELETING = "Deleting" + + +class BuildProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Resource instance provisioning state.""" + + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CANCELED = "Canceled" + CREATING = "Creating" + UPDATING = "Updating" + DELETING = "Deleting" + + +class BuildStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Status of the build once it has been provisioned.""" + + NOT_STARTED = "NotStarted" + IN_PROGRESS = "InProgress" + SUCCEEDED = "Succeeded" + CANCELED = "Canceled" + FAILED = "Failed" + + class CertificateProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Provisioning state of the certificate.""" @@ -81,6 +113,15 @@ class CertificateProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta) PENDING = "Pending" +class CertificateType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of the certificate. Allowed values are ``ServerSSLCertificate`` and + ``ImagePullTrustedCA``. + """ + + SERVER_SSL_CERTIFICATE = "ServerSSLCertificate" + IMAGE_PULL_TRUSTED_CA = "ImagePullTrustedCA" + + class CheckNameAvailabilityReason(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The reason why the given name is not available.""" @@ -127,6 +168,13 @@ class ContainerAppReplicaRunningState(str, Enum, metaclass=CaseInsensitiveEnumMe UNKNOWN = "Unknown" +class ContainerType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The container type of the sessions.""" + + CUSTOM_CONTAINER = "CustomContainer" + PYTHON_LTS = "PythonLTS" + + class CookieExpirationConvention(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The convention used when determining the session cookie's expiration.""" @@ -143,6 +191,14 @@ class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): KEY = "Key" +class DetectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The status of the patch detection.""" + + SUCCEEDED = "Succeeded" + REGISTRY_LOGIN_FAILED = "RegistryLoginFailed" + FAILED = "Failed" + + class DnsVerificationTestResult(str, Enum, metaclass=CaseInsensitiveEnumMeta): """DNS verification test result.""" @@ -151,6 +207,22 @@ class DnsVerificationTestResult(str, Enum, metaclass=CaseInsensitiveEnumMeta): SKIPPED = "Skipped" +class DotNetComponentProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Provisioning state of the .NET Component.""" + + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CANCELED = "Canceled" + DELETING = "Deleting" + IN_PROGRESS = "InProgress" + + +class DotNetComponentType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of the .NET Component.""" + + ASPIRE_DASHBOARD = "AspireDashboard" + + class EnvironmentProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Provisioning state of the Environment.""" @@ -166,6 +238,12 @@ class EnvironmentProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta) UPGRADE_FAILED = "UpgradeFailed" +class ExecutionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The execution type of the session pool.""" + + TIMED = "Timed" + + class ExtendedLocationTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of extendedLocation.""" @@ -180,6 +258,26 @@ class ForwardProxyConvention(str, Enum, metaclass=CaseInsensitiveEnumMeta): CUSTOM = "Custom" +class IdentitySettingsLifeCycle(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Use to select the lifecycle stages of a Container App during which the Managed Identity should + be available. + """ + + INIT = "Init" + MAIN = "Main" + NONE = "None" + ALL = "All" + + +class ImageType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of the image. Set to CloudBuild to let the system manages the image, where user will + not be able to update image through image field. Set to ContainerImage for user provided image. + """ + + CLOUD_BUILD = "CloudBuild" + CONTAINER_IMAGE = "ContainerImage" + + class IngressClientCertificateMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Client certificate mode for mTLS authentication. Ignore indicates server drops client certificate on forwarding. Accept indicates server forwards client certificate but does not @@ -191,6 +289,13 @@ class IngressClientCertificateMode(str, Enum, metaclass=CaseInsensitiveEnumMeta) REQUIRE = "require" +class IngressTargetPortHttpScheme(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Whether an http app listens on http or https.""" + + HTTP = "http" + HTTPS = "https" + + class IngressTransportMethod(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Ingress transport protocol.""" @@ -200,6 +305,26 @@ class IngressTransportMethod(str, Enum, metaclass=CaseInsensitiveEnumMeta): TCP = "tcp" +class JavaComponentProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Provisioning state of the Java Component.""" + + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CANCELED = "Canceled" + DELETING = "Deleting" + IN_PROGRESS = "InProgress" + + +class JavaComponentType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of the Java Component.""" + + SPRING_BOOT_ADMIN = "SpringBootAdmin" + SPRING_CLOUD_EUREKA = "SpringCloudEureka" + SPRING_CLOUD_CONFIG = "SpringCloudConfig" + SPRING_CLOUD_GATEWAY = "SpringCloudGateway" + NACOS = "Nacos" + + class JobExecutionRunningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Current running State of the job.""" @@ -222,6 +347,41 @@ class JobProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): DELETING = "Deleting" +class JobRunningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Current running state of the job.""" + + READY = "Ready" + PROGRESSING = "Progressing" + SUSPENDED = "Suspended" + + +class Kind(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Metadata used to render different experiences for resources of the same type; e.g. WorkflowApp + is a kind of Microsoft.App/ContainerApps type. If supported, the resource provider must + validate and persist this value. + """ + + WORKFLOWAPP = "workflowapp" + + +class Level(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The specified logger's log level.""" + + OFF = "off" + ERROR = "error" + INFO = "info" + DEBUG = "debug" + TRACE = "trace" + WARN = "warn" + + +class LogicAppsProxyMethod(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """LogicAppsProxyMethod.""" + + GET = "GET" + POST = "POST" + + class LogLevel(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Sets the log level for the Dapr sidecar. Allowed values are debug, info, warn, error. Default is info. @@ -252,6 +412,76 @@ class ManagedServiceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned,UserAssigned" +class PatchApplyStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The status of the patch once it has been provisioned.""" + + NOT_STARTED = "NotStarted" + REBASE_IN_PROGRESS = "RebaseInProgress" + CREATING_REVISION = "CreatingRevision" + SUCCEEDED = "Succeeded" + CANCELED = "Canceled" + REBASE_FAILED = "RebaseFailed" + REVISION_CREATION_FAILED = "RevisionCreationFailed" + IMAGE_PUSH_PULL_FAILED = "ImagePushPullFailed" + MANUALLY_SKIPPED = "ManuallySkipped" + + +class PatchingMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Patching mode for the container app. Null or default in this field will be interpreted as + Automatic by RP. Automatic mode will automatically apply available patches. Manual mode will + require the user to manually apply patches. Disabled mode will stop patch detection and auto + patching. + """ + + AUTOMATIC = "Automatic" + MANUAL = "Manual" + DISABLED = "Disabled" + + +class PatchType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type for the patch.""" + + FRAMEWORK_SECURITY = "FrameworkSecurity" + OS_SECURITY = "OSSecurity" + FRAMEWORK_AND_OS_SECURITY = "FrameworkAndOSSecurity" + OTHER = "Other" + + +class PoolManagementType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The pool management type of the session pool.""" + + MANUAL = "Manual" + DYNAMIC = "Dynamic" + + +class PrivateEndpointConnectionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The current provisioning state.""" + + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CANCELED = "Canceled" + WAITING = "Waiting" + UPDATING = "Updating" + DELETING = "Deleting" + PENDING = "Pending" + + +class PrivateEndpointServiceConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The private endpoint connection status.""" + + PENDING = "Pending" + APPROVED = "Approved" + REJECTED = "Rejected" + DISCONNECTED = "Disconnected" + + +class PublicNetworkAccess(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Property to allow or block all public traffic. Allowed Values: 'Enabled', 'Disabled'.""" + + ENABLED = "Enabled" + DISABLED = "Disabled" + + class RevisionHealthState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Current health State of the revision.""" @@ -288,6 +518,23 @@ class Scheme(str, Enum, metaclass=CaseInsensitiveEnumMeta): HTTPS = "HTTPS" +class SessionNetworkStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Network status for the sessions.""" + + EGRESS_ENABLED = "EgressEnabled" + EGRESS_DISABLED = "EgressDisabled" + + +class SessionPoolProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Provisioning state of the session pool.""" + + IN_PROGRESS = "InProgress" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CANCELED = "Canceled" + DELETING = "Deleting" + + class SourceControlOperationState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Current provisioning State of the operation.""" @@ -303,6 +550,8 @@ class StorageType(str, Enum, metaclass=CaseInsensitiveEnumMeta): AZURE_FILE = "AzureFile" EMPTY_DIR = "EmptyDir" SECRET = "Secret" + NFS_AZURE_FILE = "NfsAzureFile" + SMB = "Smb" class TriggerType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -328,3 +577,23 @@ class UnauthenticatedClientActionV2(str, Enum, metaclass=CaseInsensitiveEnumMeta ALLOW_ANONYMOUS = "AllowAnonymous" RETURN401 = "Return401" RETURN403 = "Return403" + + +class WorkflowHealthState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Gets or sets the workflow health state.""" + + NOT_SPECIFIED = "NotSpecified" + HEALTHY = "Healthy" + UNHEALTHY = "Unhealthy" + UNKNOWN = "Unknown" + + +class WorkflowState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The workflow state.""" + + NOT_SPECIFIED = "NotSpecified" + COMPLETED = "Completed" + ENABLED = "Enabled" + DISABLED = "Disabled" + DELETED = "Deleted" + SUSPENDED = "Suspended" diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/models/_models_py3.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/models/_models_py3.py index d062d9bdef6d..fae7ddf612a3 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/models/_models_py3.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/models/_models_py3.py @@ -74,6 +74,26 @@ def __init__( self.identities = identities +class AppInsightsConfiguration(_serialization.Model): + """Configuration of Application Insights. + + :ivar connection_string: Application Insights connection string. + :vartype connection_string: str + """ + + _attribute_map = { + "connection_string": {"key": "connectionString", "type": "str"}, + } + + def __init__(self, *, connection_string: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword connection_string: Application Insights connection string. + :paramtype connection_string: str + """ + super().__init__(**kwargs) + self.connection_string = connection_string + + class Apple(_serialization.Model): """The configuration settings of the Apple provider. @@ -213,8 +233,8 @@ class Resource(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -255,8 +275,27 @@ class ProxyResource(Resource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData + """ + + +class AppResiliency(ProxyResource): + """Configuration to setup App Resiliency. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -266,8 +305,106 @@ class ProxyResource(Resource): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData + :ivar timeout_policy: Policy to set request timeouts. + :vartype timeout_policy: ~azure.mgmt.appcontainers.models.TimeoutPolicy + :ivar http_retry_policy: Policy that defines http request retry conditions. + :vartype http_retry_policy: ~azure.mgmt.appcontainers.models.HttpRetryPolicy + :ivar tcp_retry_policy: Policy that defines tcp request retry conditions. + :vartype tcp_retry_policy: ~azure.mgmt.appcontainers.models.TcpRetryPolicy + :ivar circuit_breaker_policy: Policy that defines circuit breaker conditions. + :vartype circuit_breaker_policy: ~azure.mgmt.appcontainers.models.CircuitBreakerPolicy + :ivar http_connection_pool: Defines parameters for http connection pooling. + :vartype http_connection_pool: ~azure.mgmt.appcontainers.models.HttpConnectionPool + :ivar tcp_connection_pool: Defines parameters for tcp connection pooling. + :vartype tcp_connection_pool: ~azure.mgmt.appcontainers.models.TcpConnectionPool + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "timeout_policy": {"key": "properties.timeoutPolicy", "type": "TimeoutPolicy"}, + "http_retry_policy": {"key": "properties.httpRetryPolicy", "type": "HttpRetryPolicy"}, + "tcp_retry_policy": {"key": "properties.tcpRetryPolicy", "type": "TcpRetryPolicy"}, + "circuit_breaker_policy": {"key": "properties.circuitBreakerPolicy", "type": "CircuitBreakerPolicy"}, + "http_connection_pool": {"key": "properties.httpConnectionPool", "type": "HttpConnectionPool"}, + "tcp_connection_pool": {"key": "properties.tcpConnectionPool", "type": "TcpConnectionPool"}, + } + + def __init__( + self, + *, + timeout_policy: Optional["_models.TimeoutPolicy"] = None, + http_retry_policy: Optional["_models.HttpRetryPolicy"] = None, + tcp_retry_policy: Optional["_models.TcpRetryPolicy"] = None, + circuit_breaker_policy: Optional["_models.CircuitBreakerPolicy"] = None, + http_connection_pool: Optional["_models.HttpConnectionPool"] = None, + tcp_connection_pool: Optional["_models.TcpConnectionPool"] = None, + **kwargs: Any + ) -> None: + """ + :keyword timeout_policy: Policy to set request timeouts. + :paramtype timeout_policy: ~azure.mgmt.appcontainers.models.TimeoutPolicy + :keyword http_retry_policy: Policy that defines http request retry conditions. + :paramtype http_retry_policy: ~azure.mgmt.appcontainers.models.HttpRetryPolicy + :keyword tcp_retry_policy: Policy that defines tcp request retry conditions. + :paramtype tcp_retry_policy: ~azure.mgmt.appcontainers.models.TcpRetryPolicy + :keyword circuit_breaker_policy: Policy that defines circuit breaker conditions. + :paramtype circuit_breaker_policy: ~azure.mgmt.appcontainers.models.CircuitBreakerPolicy + :keyword http_connection_pool: Defines parameters for http connection pooling. + :paramtype http_connection_pool: ~azure.mgmt.appcontainers.models.HttpConnectionPool + :keyword tcp_connection_pool: Defines parameters for tcp connection pooling. + :paramtype tcp_connection_pool: ~azure.mgmt.appcontainers.models.TcpConnectionPool + """ + super().__init__(**kwargs) + self.timeout_policy = timeout_policy + self.http_retry_policy = http_retry_policy + self.tcp_retry_policy = tcp_retry_policy + self.circuit_breaker_policy = circuit_breaker_policy + self.http_connection_pool = http_connection_pool + self.tcp_connection_pool = tcp_connection_pool + + +class AppResiliencyCollection(_serialization.Model): + """Collection of AppResiliency policies. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar value: Collection of resources. Required. + :vartype value: list[~azure.mgmt.appcontainers.models.AppResiliency] + :ivar next_link: Link to next page of resources. + :vartype next_link: str """ + _validation = { + "value": {"required": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[AppResiliency]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.AppResiliency"], **kwargs: Any) -> None: + """ + :keyword value: Collection of resources. Required. + :paramtype value: list[~azure.mgmt.appcontainers.models.AppResiliency] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + class AuthConfig(ProxyResource): """Configuration settings for the Azure ContainerApp Service Authentication / Authorization @@ -275,8 +412,8 @@ class AuthConfig(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -469,8 +606,8 @@ class AvailableWorkloadProfile(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -1023,6 +1160,10 @@ class BaseContainer(_serialization.Model): :ivar image: Container image tag. :vartype image: str + :ivar image_type: The type of the image. Set to CloudBuild to let the system manages the image, + where user will not be able to update image through image field. Set to ContainerImage for user + provided image. Known values are: "CloudBuild" and "ContainerImage". + :vartype image_type: str or ~azure.mgmt.appcontainers.models.ImageType :ivar name: Custom container name. :vartype name: str :ivar command: Container start command. @@ -1039,6 +1180,7 @@ class BaseContainer(_serialization.Model): _attribute_map = { "image": {"key": "image", "type": "str"}, + "image_type": {"key": "imageType", "type": "str"}, "name": {"key": "name", "type": "str"}, "command": {"key": "command", "type": "[str]"}, "args": {"key": "args", "type": "[str]"}, @@ -1051,6 +1193,7 @@ def __init__( self, *, image: Optional[str] = None, + image_type: Optional[Union[str, "_models.ImageType"]] = None, name: Optional[str] = None, command: Optional[List[str]] = None, args: Optional[List[str]] = None, @@ -1062,6 +1205,10 @@ def __init__( """ :keyword image: Container image tag. :paramtype image: str + :keyword image_type: The type of the image. Set to CloudBuild to let the system manages the + image, where user will not be able to update image through image field. Set to ContainerImage + for user provided image. Known values are: "CloudBuild" and "ContainerImage". + :paramtype image_type: str or ~azure.mgmt.appcontainers.models.ImageType :keyword name: Custom container name. :paramtype name: str :keyword command: Container start command. @@ -1077,6 +1224,7 @@ def __init__( """ super().__init__(**kwargs) self.image = image + self.image_type = image_type self.name = name self.command = command self.args = args @@ -1085,7 +1233,7 @@ def __init__( self.volume_mounts = volume_mounts -class BillingMeter(ProxyResource): +class BillingMeter(_serialization.Model): """Billing meter. Variables are only populated by the server, and will be ignored when sending a request. @@ -1137,6 +1285,10 @@ def __init__( :paramtype properties: ~azure.mgmt.appcontainers.models.BillingMeterProperties """ super().__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.system_data = None self.location = location self.properties = properties @@ -1234,6 +1386,127 @@ def __init__(self, *, sas_url_setting_name: str, **kwargs: Any) -> None: self.sas_url_setting_name = sas_url_setting_name +class BuildCollection(_serialization.Model): + """The response of a BuildResource list operation. + + All required parameters must be populated in order to send to 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): """The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'. @@ -1242,8 +1515,8 @@ class TrackedResource(Resource): All required parameters must be populated in order to send to server. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -1288,15 +1561,15 @@ def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kw self.location = location -class Certificate(TrackedResource): - """Certificate used for Custom Domain bindings of Container Apps in a Managed Environment. +class BuilderResource(TrackedResource): + """Information about the SourceToCloud builder resource. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to server. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -1310,8 +1583,17 @@ class Certificate(TrackedResource): :vartype tags: dict[str, str] :ivar location: The geo-location where the resource lives. Required. :vartype location: str - :ivar properties: Certificate resource specific properties. - :vartype properties: ~azure.mgmt.appcontainers.models.CertificateProperties + :ivar identity: The managed service identities assigned to this resource. + :vartype identity: ~azure.mgmt.appcontainers.models.ManagedServiceIdentity + :ivar provisioning_state: Provisioning state of a builder resource. Known values are: + "Succeeded", "Failed", "Canceled", "Creating", "Updating", and "Deleting". + :vartype provisioning_state: str or ~azure.mgmt.appcontainers.models.BuilderProvisioningState + :ivar environment_id: Resource ID of the container apps environment that the builder is + associated with. + :vartype environment_id: str + :ivar container_registries: List of mappings of container registries and the managed identity + used to connect to it. + :vartype container_registries: list[~azure.mgmt.appcontainers.models.ContainerRegistry] """ _validation = { @@ -1320,6 +1602,7 @@ class Certificate(TrackedResource): "type": {"readonly": True}, "system_data": {"readonly": True}, "location": {"required": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { @@ -1329,7 +1612,10 @@ class Certificate(TrackedResource): "system_data": {"key": "systemData", "type": "SystemData"}, "tags": {"key": "tags", "type": "{str}"}, "location": {"key": "location", "type": "str"}, - "properties": {"key": "properties", "type": "CertificateProperties"}, + "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "environment_id": {"key": "properties.environmentId", "type": "str"}, + "container_registries": {"key": "properties.containerRegistries", "type": "[ContainerRegistry]"}, } def __init__( @@ -1337,7 +1623,9 @@ def __init__( *, location: str, tags: Optional[Dict[str, str]] = None, - properties: Optional["_models.CertificateProperties"] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, + environment_id: Optional[str] = None, + container_registries: Optional[List["_models.ContainerRegistry"]] = None, **kwargs: Any ) -> None: """ @@ -1345,95 +1633,363 @@ def __init__( :paramtype tags: dict[str, str] :keyword location: The geo-location where the resource lives. Required. :paramtype location: str - :keyword properties: Certificate resource specific properties. - :paramtype properties: ~azure.mgmt.appcontainers.models.CertificateProperties + :keyword identity: The managed service identities assigned to this resource. + :paramtype identity: ~azure.mgmt.appcontainers.models.ManagedServiceIdentity + :keyword environment_id: Resource ID of the container apps environment that the builder is + associated with. + :paramtype environment_id: str + :keyword container_registries: List of mappings of container registries and the managed + identity used to connect to it. + :paramtype container_registries: list[~azure.mgmt.appcontainers.models.ContainerRegistry] """ super().__init__(tags=tags, location=location, **kwargs) - self.properties = properties - - -class CertificateCollection(_serialization.Model): - """Collection of Certificates. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar value: Collection of resources. Required. - :vartype value: list[~azure.mgmt.appcontainers.models.Certificate] - :ivar next_link: Link to next page of resources. - :vartype next_link: str - """ - - _validation = { - "value": {"required": True}, - "next_link": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[Certificate]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, value: List["_models.Certificate"], **kwargs: Any) -> None: - """ - :keyword value: Collection of resources. Required. - :paramtype value: list[~azure.mgmt.appcontainers.models.Certificate] - """ - super().__init__(**kwargs) - self.value = value - self.next_link = None + self.identity = identity + self.provisioning_state = None + self.environment_id = environment_id + self.container_registries = container_registries -class CertificatePatch(_serialization.Model): - """A certificate to update. +class BuilderResourceUpdate(_serialization.Model): + """The type used for update operations of the BuilderResource. - :ivar tags: Application-specific metadata in the form of key-value pairs. + :ivar identity: The managed service identities assigned to this resource. + :vartype identity: ~azure.mgmt.appcontainers.models.ManagedServiceIdentity + :ivar tags: Resource tags. :vartype tags: dict[str, str] + :ivar environment_id: Resource ID of the container apps environment that the builder is + associated with. + :vartype environment_id: str """ _attribute_map = { + "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, "tags": {"key": "tags", "type": "{str}"}, + "environment_id": {"key": "properties.environmentId", "type": "str"}, } - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: + def __init__( + self, + *, + identity: Optional["_models.ManagedServiceIdentity"] = None, + tags: Optional[Dict[str, str]] = None, + environment_id: Optional[str] = None, + **kwargs: Any + ) -> None: """ - :keyword tags: Application-specific metadata in the form of key-value pairs. + :keyword identity: The managed service identities assigned to this resource. + :paramtype identity: ~azure.mgmt.appcontainers.models.ManagedServiceIdentity + :keyword tags: Resource tags. :paramtype tags: dict[str, str] + :keyword environment_id: Resource ID of the container apps environment that the builder is + associated with. + :paramtype environment_id: str """ super().__init__(**kwargs) + self.identity = identity self.tags = tags + self.environment_id = environment_id -class CertificateProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes - """Certificate resource specific properties. +class BuildResource(ProxyResource): # pylint: disable=too-many-instance-attributes + """Information pertaining to an individual build. Variables are only populated by the server, and will be ignored when sending a request. - :ivar provisioning_state: Provisioning state of the certificate. Known values are: "Succeeded", - "Failed", "Canceled", "DeleteFailed", and "Pending". - :vartype provisioning_state: str or - ~azure.mgmt.appcontainers.models.CertificateProvisioningState - :ivar password: Certificate password. - :vartype password: str - :ivar subject_name: Subject name of the certificate. - :vartype subject_name: str - :ivar subject_alternative_names: Subject alternative names the certificate applies to. - :vartype subject_alternative_names: list[str] - :ivar value: PFX or PEM blob. - :vartype value: bytes - :ivar issuer: Certificate issuer. - :vartype issuer: str - :ivar issue_date: Certificate issue Date. - :vartype issue_date: ~datetime.datetime - :ivar expiration_date: Certificate expiration date. - :vartype expiration_date: ~datetime.datetime - :ivar thumbprint: Certificate thumbprint. - :vartype thumbprint: str - :ivar valid: Is the certificate valid?. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData + :ivar provisioning_state: Build provisioning state. Known values are: "Succeeded", "Failed", + "Canceled", "Creating", "Updating", and "Deleting". + :vartype provisioning_state: str or ~azure.mgmt.appcontainers.models.BuildProvisioningState + :ivar build_status: Status of the build once it has been provisioned. Known values are: + "NotStarted", "InProgress", "Succeeded", "Canceled", and "Failed". + :vartype build_status: str or ~azure.mgmt.appcontainers.models.BuildStatus + :ivar destination_container_registry: Container registry that the final image will be uploaded + to. + :vartype destination_container_registry: + ~azure.mgmt.appcontainers.models.ContainerRegistryWithCustomImage + :ivar configuration: Configuration of the build. + :vartype configuration: ~azure.mgmt.appcontainers.models.BuildConfiguration + :ivar upload_endpoint: Endpoint to which the source code should be uploaded. + :vartype upload_endpoint: str + :ivar log_stream_endpoint: Endpoint from which the build logs can be streamed. + :vartype log_stream_endpoint: str + :ivar token_endpoint: Endpoint to use to retrieve an authentication token for log streaming and + uploading source code. + :vartype token_endpoint: str + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "build_status": {"readonly": True}, + "upload_endpoint": {"readonly": True}, + "log_stream_endpoint": {"readonly": True}, + "token_endpoint": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "build_status": {"key": "properties.buildStatus", "type": "str"}, + "destination_container_registry": { + "key": "properties.destinationContainerRegistry", + "type": "ContainerRegistryWithCustomImage", + }, + "configuration": {"key": "properties.configuration", "type": "BuildConfiguration"}, + "upload_endpoint": {"key": "properties.uploadEndpoint", "type": "str"}, + "log_stream_endpoint": {"key": "properties.logStreamEndpoint", "type": "str"}, + "token_endpoint": {"key": "properties.tokenEndpoint", "type": "str"}, + } + + def __init__( + self, + *, + destination_container_registry: Optional["_models.ContainerRegistryWithCustomImage"] = None, + configuration: Optional["_models.BuildConfiguration"] = None, + **kwargs: Any + ) -> None: + """ + :keyword destination_container_registry: Container registry that the final image will be + uploaded to. + :paramtype destination_container_registry: + ~azure.mgmt.appcontainers.models.ContainerRegistryWithCustomImage + :keyword configuration: Configuration of the build. + :paramtype configuration: ~azure.mgmt.appcontainers.models.BuildConfiguration + """ + super().__init__(**kwargs) + self.provisioning_state = None + self.build_status = None + self.destination_container_registry = destination_container_registry + self.configuration = configuration + self.upload_endpoint = None + self.log_stream_endpoint = None + self.token_endpoint = None + + +class BuildToken(_serialization.Model): + """Build Auth Token. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar token: Authentication token. + :vartype token: str + :ivar expires: Token expiration date. + :vartype expires: ~datetime.datetime + """ + + _validation = { + "token": {"readonly": True}, + "expires": {"readonly": True}, + } + + _attribute_map = { + "token": {"key": "token", "type": "str"}, + "expires": {"key": "expires", "type": "iso-8601"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.token = None + self.expires = None + + +class Certificate(TrackedResource): + """Certificate used for Custom Domain bindings of Container Apps in a Managed Environment. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar properties: Certificate resource specific properties. + :vartype properties: ~azure.mgmt.appcontainers.models.CertificateProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "properties": {"key": "properties", "type": "CertificateProperties"}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + properties: Optional["_models.CertificateProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str + :keyword properties: Certificate resource specific properties. + :paramtype properties: ~azure.mgmt.appcontainers.models.CertificateProperties + """ + super().__init__(tags=tags, location=location, **kwargs) + self.properties = properties + + +class CertificateCollection(_serialization.Model): + """Collection of Certificates. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar value: Collection of resources. Required. + :vartype value: list[~azure.mgmt.appcontainers.models.Certificate] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[Certificate]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.Certificate"], **kwargs: Any) -> None: + """ + :keyword value: Collection of resources. Required. + :paramtype value: list[~azure.mgmt.appcontainers.models.Certificate] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class CertificateKeyVaultProperties(_serialization.Model): + """Properties for a certificate stored in a Key Vault. + + :ivar identity: Resource ID of a managed identity to authenticate with Azure Key Vault, or + System to use a system-assigned identity. + :vartype identity: str + :ivar key_vault_url: URL pointing to the Azure Key Vault secret that holds the certificate. + :vartype key_vault_url: str + """ + + _attribute_map = { + "identity": {"key": "identity", "type": "str"}, + "key_vault_url": {"key": "keyVaultUrl", "type": "str"}, + } + + def __init__(self, *, identity: Optional[str] = None, key_vault_url: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword identity: Resource ID of a managed identity to authenticate with Azure Key Vault, or + System to use a system-assigned identity. + :paramtype identity: str + :keyword key_vault_url: URL pointing to the Azure Key Vault secret that holds the certificate. + :paramtype key_vault_url: str + """ + super().__init__(**kwargs) + self.identity = identity + self.key_vault_url = key_vault_url + + +class CertificatePatch(_serialization.Model): + """A certificate to update. + + :ivar tags: Application-specific metadata in the form of key-value pairs. + :vartype tags: dict[str, str] + """ + + _attribute_map = { + "tags": {"key": "tags", "type": "{str}"}, + } + + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: + """ + :keyword tags: Application-specific metadata in the form of key-value pairs. + :paramtype tags: dict[str, str] + """ + super().__init__(**kwargs) + self.tags = tags + + +class CertificateProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes + """Certificate resource specific properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: Provisioning state of the certificate. Known values are: "Succeeded", + "Failed", "Canceled", "DeleteFailed", and "Pending". + :vartype provisioning_state: str or + ~azure.mgmt.appcontainers.models.CertificateProvisioningState + :ivar certificate_key_vault_properties: Properties for a certificate stored in a Key Vault. + :vartype certificate_key_vault_properties: + ~azure.mgmt.appcontainers.models.CertificateKeyVaultProperties + :ivar password: Certificate password. + :vartype password: str + :ivar subject_name: Subject name of the certificate. + :vartype subject_name: str + :ivar subject_alternative_names: Subject alternative names the certificate applies to. + :vartype subject_alternative_names: list[str] + :ivar value: PFX or PEM blob. + :vartype value: bytes + :ivar issuer: Certificate issuer. + :vartype issuer: str + :ivar issue_date: Certificate issue Date. + :vartype issue_date: ~datetime.datetime + :ivar expiration_date: Certificate expiration date. + :vartype expiration_date: ~datetime.datetime + :ivar thumbprint: Certificate thumbprint. + :vartype thumbprint: str + :ivar valid: Is the certificate valid?. :vartype valid: bool :ivar public_key_hash: Public key hash. :vartype public_key_hash: str + :ivar certificate_type: The type of the certificate. Allowed values are + ``ServerSSLCertificate`` and ``ImagePullTrustedCA``. Known values are: "ServerSSLCertificate" + and "ImagePullTrustedCA". + :vartype certificate_type: str or ~azure.mgmt.appcontainers.models.CertificateType """ _validation = { @@ -1450,6 +2006,10 @@ class CertificateProperties(_serialization.Model): # pylint: disable=too-many-i _attribute_map = { "provisioning_state": {"key": "provisioningState", "type": "str"}, + "certificate_key_vault_properties": { + "key": "certificateKeyVaultProperties", + "type": "CertificateKeyVaultProperties", + }, "password": {"key": "password", "type": "str"}, "subject_name": {"key": "subjectName", "type": "str"}, "subject_alternative_names": {"key": "subjectAlternativeNames", "type": "[str]"}, @@ -1460,17 +2020,34 @@ class CertificateProperties(_serialization.Model): # pylint: disable=too-many-i "thumbprint": {"key": "thumbprint", "type": "str"}, "valid": {"key": "valid", "type": "bool"}, "public_key_hash": {"key": "publicKeyHash", "type": "str"}, + "certificate_type": {"key": "certificateType", "type": "str"}, } - def __init__(self, *, password: Optional[str] = None, value: Optional[bytes] = None, **kwargs: Any) -> None: + def __init__( + self, + *, + certificate_key_vault_properties: Optional["_models.CertificateKeyVaultProperties"] = None, + password: Optional[str] = None, + value: Optional[bytes] = None, + certificate_type: Optional[Union[str, "_models.CertificateType"]] = None, + **kwargs: Any + ) -> None: """ + :keyword certificate_key_vault_properties: Properties for a certificate stored in a Key Vault. + :paramtype certificate_key_vault_properties: + ~azure.mgmt.appcontainers.models.CertificateKeyVaultProperties :keyword password: Certificate password. :paramtype password: str :keyword value: PFX or PEM blob. :paramtype value: bytes + :keyword certificate_type: The type of the certificate. Allowed values are + ``ServerSSLCertificate`` and ``ImagePullTrustedCA``. Known values are: "ServerSSLCertificate" + and "ImagePullTrustedCA". + :paramtype certificate_type: str or ~azure.mgmt.appcontainers.models.CertificateType """ super().__init__(**kwargs) self.provisioning_state = None + self.certificate_key_vault_properties = certificate_key_vault_properties self.password = password self.subject_name = None self.subject_alternative_names = None @@ -1481,6 +2058,7 @@ def __init__(self, *, password: Optional[str] = None, value: Optional[bytes] = N self.thumbprint = None self.valid = None self.public_key_hash = None + self.certificate_type = certificate_type class CheckNameAvailabilityRequest(_serialization.Model): @@ -1550,6 +2128,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. @@ -1602,10 +2225,15 @@ class Configuration(_serialization.Model): :vartype registries: list[~azure.mgmt.appcontainers.models.RegistryCredentials] :ivar dapr: Dapr configuration for the Container App. :vartype dapr: ~azure.mgmt.appcontainers.models.Dapr + :ivar runtime: App runtime configuration for the Container App. + :vartype runtime: ~azure.mgmt.appcontainers.models.Runtime :ivar max_inactive_revisions: Optional. Max inactive revisions a Container App can have. :vartype max_inactive_revisions: int :ivar service: Container App to be a dev Container App Service. :vartype service: ~azure.mgmt.appcontainers.models.Service + :ivar identity_settings: Optional settings for Managed Identities that are assigned to the + Container App. If a Managed Identity is not specified here, default settings will be used. + :vartype identity_settings: list[~azure.mgmt.appcontainers.models.IdentitySettings] """ _attribute_map = { @@ -1614,8 +2242,10 @@ class Configuration(_serialization.Model): "ingress": {"key": "ingress", "type": "Ingress"}, "registries": {"key": "registries", "type": "[RegistryCredentials]"}, "dapr": {"key": "dapr", "type": "Dapr"}, + "runtime": {"key": "runtime", "type": "Runtime"}, "max_inactive_revisions": {"key": "maxInactiveRevisions", "type": "int"}, "service": {"key": "service", "type": "Service"}, + "identity_settings": {"key": "identitySettings", "type": "[IdentitySettings]"}, } def __init__( @@ -1626,8 +2256,10 @@ def __init__( ingress: Optional["_models.Ingress"] = None, registries: Optional[List["_models.RegistryCredentials"]] = None, dapr: Optional["_models.Dapr"] = None, + runtime: Optional["_models.Runtime"] = None, max_inactive_revisions: Optional[int] = None, service: Optional["_models.Service"] = None, + identity_settings: Optional[List["_models.IdentitySettings"]] = None, **kwargs: Any ) -> None: """ @@ -1650,10 +2282,15 @@ def __init__( :paramtype registries: list[~azure.mgmt.appcontainers.models.RegistryCredentials] :keyword dapr: Dapr configuration for the Container App. :paramtype dapr: ~azure.mgmt.appcontainers.models.Dapr + :keyword runtime: App runtime configuration for the Container App. + :paramtype runtime: ~azure.mgmt.appcontainers.models.Runtime :keyword max_inactive_revisions: Optional. Max inactive revisions a Container App can have. :paramtype max_inactive_revisions: int :keyword service: Container App to be a dev Container App Service. :paramtype service: ~azure.mgmt.appcontainers.models.Service + :keyword identity_settings: Optional settings for Managed Identities that are assigned to the + Container App. If a Managed Identity is not specified here, default settings will be used. + :paramtype identity_settings: list[~azure.mgmt.appcontainers.models.IdentitySettings] """ super().__init__(**kwargs) self.secrets = secrets @@ -1661,8 +2298,10 @@ def __init__( self.ingress = ingress self.registries = registries self.dapr = dapr + self.runtime = runtime self.max_inactive_revisions = max_inactive_revisions self.service = service + self.identity_settings = identity_settings class ConnectedEnvironment(TrackedResource): # pylint: disable=too-many-instance-attributes @@ -1672,8 +2311,8 @@ class ConnectedEnvironment(TrackedResource): # pylint: disable=too-many-instanc All required parameters must be populated in order to send to server. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -1810,8 +2449,8 @@ class ConnectedEnvironmentStorage(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -1856,19 +2495,31 @@ class ConnectedEnvironmentStorageProperties(_serialization.Model): :ivar azure_file: Azure file properties. :vartype azure_file: ~azure.mgmt.appcontainers.models.AzureFileProperties + :ivar smb: SMB storage properties. + :vartype smb: ~azure.mgmt.appcontainers.models.SmbStorage """ _attribute_map = { "azure_file": {"key": "azureFile", "type": "AzureFileProperties"}, + "smb": {"key": "smb", "type": "SmbStorage"}, } - def __init__(self, *, azure_file: Optional["_models.AzureFileProperties"] = None, **kwargs: Any) -> None: + def __init__( + self, + *, + azure_file: Optional["_models.AzureFileProperties"] = None, + smb: Optional["_models.SmbStorage"] = None, + **kwargs: Any + ) -> None: """ :keyword azure_file: Azure file properties. :paramtype azure_file: ~azure.mgmt.appcontainers.models.AzureFileProperties + :keyword smb: SMB storage properties. + :paramtype smb: ~azure.mgmt.appcontainers.models.SmbStorage """ super().__init__(**kwargs) self.azure_file = azure_file + self.smb = smb class ConnectedEnvironmentStoragesCollection(_serialization.Model): @@ -1902,6 +2553,10 @@ class Container(BaseContainer): :ivar image: Container image tag. :vartype image: str + :ivar image_type: The type of the image. Set to CloudBuild to let the system manages the image, + where user will not be able to update image through image field. Set to ContainerImage for user + provided image. Known values are: "CloudBuild" and "ContainerImage". + :vartype image_type: str or ~azure.mgmt.appcontainers.models.ImageType :ivar name: Custom container name. :vartype name: str :ivar command: Container start command. @@ -1920,6 +2575,7 @@ class Container(BaseContainer): _attribute_map = { "image": {"key": "image", "type": "str"}, + "image_type": {"key": "imageType", "type": "str"}, "name": {"key": "name", "type": "str"}, "command": {"key": "command", "type": "[str]"}, "args": {"key": "args", "type": "[str]"}, @@ -1933,6 +2589,7 @@ def __init__( self, *, image: Optional[str] = None, + image_type: Optional[Union[str, "_models.ImageType"]] = None, name: Optional[str] = None, command: Optional[List[str]] = None, args: Optional[List[str]] = None, @@ -1945,6 +2602,10 @@ def __init__( """ :keyword image: Container image tag. :paramtype image: str + :keyword image_type: The type of the image. Set to CloudBuild to let the system manages the + image, where user will not be able to update image through image field. Set to ContainerImage + for user provided image. Known values are: "CloudBuild" and "ContainerImage". + :paramtype image_type: str or ~azure.mgmt.appcontainers.models.ImageType :keyword name: Custom container name. :paramtype name: str :keyword command: Container start command. @@ -1962,6 +2623,7 @@ def __init__( """ super().__init__( image=image, + image_type=image_type, name=name, command=command, args=args, @@ -1980,8 +2642,8 @@ class ContainerApp(TrackedResource): # pylint: disable=too-many-instance-attrib All required parameters must be populated in order to send to server. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -2005,16 +2667,25 @@ class ContainerApp(TrackedResource): # pylint: disable=too-many-instance-attrib mode deployment will not delete the resource if it is removed from the template since it is managed by another resource. :vartype managed_by: str + :ivar kind: Metadata used to render different experiences for resources of the same type; e.g. + WorkflowApp is a kind of Microsoft.App/ContainerApps type. If supported, the resource provider + must validate and persist this value. "workflowapp" + :vartype kind: str or ~azure.mgmt.appcontainers.models.Kind :ivar provisioning_state: Provisioning state of the Container App. Known values are: "InProgress", "Succeeded", "Failed", "Canceled", and "Deleting". :vartype provisioning_state: str or ~azure.mgmt.appcontainers.models.ContainerAppProvisioningState + :ivar deployment_errors: Any errors that occurred during deployment. + :vartype deployment_errors: str :ivar managed_environment_id: Deprecated. Resource ID of the Container App's environment. :vartype managed_environment_id: str :ivar environment_id: Resource ID of environment. :vartype environment_id: str :ivar workload_profile_name: Workload profile name to pin for container app execution. :vartype workload_profile_name: str + :ivar patching_configuration: Container App auto patch configuration. + :vartype patching_configuration: + ~azure.mgmt.appcontainers.models.ContainerAppPropertiesPatchingConfiguration :ivar latest_revision_name: Name of the latest revision of the Container App. :vartype latest_revision_name: str :ivar latest_ready_revision_name: Name of the latest ready revision of the Container App. @@ -2041,6 +2712,7 @@ class ContainerApp(TrackedResource): # pylint: disable=too-many-instance-attrib "system_data": {"readonly": True}, "location": {"required": True}, "provisioning_state": {"readonly": True}, + "deployment_errors": {"readonly": True}, "latest_revision_name": {"readonly": True}, "latest_ready_revision_name": {"readonly": True}, "latest_revision_fqdn": {"readonly": True}, @@ -2059,10 +2731,16 @@ class ContainerApp(TrackedResource): # pylint: disable=too-many-instance-attrib "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, "managed_by": {"key": "managedBy", "type": "str"}, + "kind": {"key": "kind", "type": "str"}, "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "deployment_errors": {"key": "properties.deploymentErrors", "type": "str"}, "managed_environment_id": {"key": "properties.managedEnvironmentId", "type": "str"}, "environment_id": {"key": "properties.environmentId", "type": "str"}, "workload_profile_name": {"key": "properties.workloadProfileName", "type": "str"}, + "patching_configuration": { + "key": "properties.patchingConfiguration", + "type": "ContainerAppPropertiesPatchingConfiguration", + }, "latest_revision_name": {"key": "properties.latestRevisionName", "type": "str"}, "latest_ready_revision_name": {"key": "properties.latestReadyRevisionName", "type": "str"}, "latest_revision_fqdn": {"key": "properties.latestRevisionFqdn", "type": "str"}, @@ -2073,7 +2751,7 @@ class ContainerApp(TrackedResource): # pylint: disable=too-many-instance-attrib "event_stream_endpoint": {"key": "properties.eventStreamEndpoint", "type": "str"}, } - def __init__( + def __init__( # pylint: disable=too-many-locals self, *, location: str, @@ -2081,9 +2759,11 @@ def __init__( extended_location: Optional["_models.ExtendedLocation"] = None, identity: Optional["_models.ManagedServiceIdentity"] = None, managed_by: Optional[str] = None, + kind: Optional[Union[str, "_models.Kind"]] = None, managed_environment_id: Optional[str] = None, environment_id: Optional[str] = None, workload_profile_name: Optional[str] = None, + patching_configuration: Optional["_models.ContainerAppPropertiesPatchingConfiguration"] = None, configuration: Optional["_models.Configuration"] = None, template: Optional["_models.Template"] = None, **kwargs: Any @@ -2103,12 +2783,19 @@ def __init__( complete mode deployment will not delete the resource if it is removed from the template since it is managed by another resource. :paramtype managed_by: str + :keyword kind: Metadata used to render different experiences for resources of the same type; + e.g. WorkflowApp is a kind of Microsoft.App/ContainerApps type. If supported, the resource + provider must validate and persist this value. "workflowapp" + :paramtype kind: str or ~azure.mgmt.appcontainers.models.Kind :keyword managed_environment_id: Deprecated. Resource ID of the Container App's environment. :paramtype managed_environment_id: str :keyword environment_id: Resource ID of environment. :paramtype environment_id: str :keyword workload_profile_name: Workload profile name to pin for container app execution. :paramtype workload_profile_name: str + :keyword patching_configuration: Container App auto patch configuration. + :paramtype patching_configuration: + ~azure.mgmt.appcontainers.models.ContainerAppPropertiesPatchingConfiguration :keyword configuration: Non versioned Container App configuration properties. :paramtype configuration: ~azure.mgmt.appcontainers.models.Configuration :keyword template: Container App versioned application definition. @@ -2118,10 +2805,13 @@ def __init__( self.extended_location = extended_location self.identity = identity self.managed_by = managed_by + self.kind = kind self.provisioning_state = None + self.deployment_errors = None self.managed_environment_id = managed_environment_id self.environment_id = environment_id self.workload_profile_name = workload_profile_name + self.patching_configuration = patching_configuration self.latest_revision_name = None self.latest_ready_revision_name = None self.latest_revision_fqdn = None @@ -2139,8 +2829,8 @@ class ContainerAppAuthToken(TrackedResource): All required parameters must be populated in order to send to server. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -2505,6 +3195,179 @@ def __init__(self, *, port: int, host: Optional[str] = None, **kwargs: Any) -> N self.port = port +class ContainerAppPropertiesPatchingConfiguration(_serialization.Model): # pylint: disable=name-too-long + """Container App auto patch configuration. + + :ivar patching_mode: Patching mode for the container app. Null or default in this field will be + interpreted as Automatic by RP. Automatic mode will automatically apply available patches. + Manual mode will require the user to manually apply patches. Disabled mode will stop patch + detection and auto patching. Known values are: "Automatic", "Manual", and "Disabled". + :vartype patching_mode: str or ~azure.mgmt.appcontainers.models.PatchingMode + """ + + _attribute_map = { + "patching_mode": {"key": "patchingMode", "type": "str"}, + } + + def __init__(self, *, patching_mode: Optional[Union[str, "_models.PatchingMode"]] = None, **kwargs: Any) -> None: + """ + :keyword patching_mode: Patching mode for the container app. Null or default in this field will + be interpreted as Automatic by RP. Automatic mode will automatically apply available patches. + Manual mode will require the user to manually apply patches. Disabled mode will stop patch + detection and auto patching. Known values are: "Automatic", "Manual", and "Disabled". + :paramtype patching_mode: str or ~azure.mgmt.appcontainers.models.PatchingMode + """ + super().__init__(**kwargs) + self.patching_mode = patching_mode + + +class ContainerAppsBuildCollection(_serialization.Model): + """The response of a Container Apps Build Resource list operation. + + All required parameters must be populated in order to send to server. + + :ivar value: The Container Apps Build Resource items on this page. Required. + :vartype value: list[~azure.mgmt.appcontainers.models.ContainerAppsBuildResource] + :ivar next_link: The link to the next page of items. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[ContainerAppsBuildResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: List["_models.ContainerAppsBuildResource"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The Container Apps Build Resource items on this page. Required. + :paramtype value: list[~azure.mgmt.appcontainers.models.ContainerAppsBuildResource] + :keyword next_link: The link to the next page of items. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ContainerAppsBuildConfiguration(_serialization.Model): + """Configuration of the build. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar base_os: Base OS used to build and run the app. + :vartype base_os: str + :ivar platform: Platform to be used to build and run the app. + :vartype platform: str + :ivar platform_version: Platform version to be used to build and run the app. + :vartype platform_version: str + :ivar environment_variables: List of environment variables to be passed to the build, secrets + should not be used in environment variable. + :vartype environment_variables: list[~azure.mgmt.appcontainers.models.EnvironmentVariable] + :ivar pre_build_steps: List of steps to perform before the build. + :vartype pre_build_steps: list[~azure.mgmt.appcontainers.models.PreBuildStep] + """ + + _validation = { + "base_os": {"readonly": True}, + "platform": {"readonly": True}, + "platform_version": {"readonly": True}, + "environment_variables": {"readonly": True}, + "pre_build_steps": {"readonly": True}, + } + + _attribute_map = { + "base_os": {"key": "baseOs", "type": "str"}, + "platform": {"key": "platform", "type": "str"}, + "platform_version": {"key": "platformVersion", "type": "str"}, + "environment_variables": {"key": "environmentVariables", "type": "[EnvironmentVariable]"}, + "pre_build_steps": {"key": "preBuildSteps", "type": "[PreBuildStep]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.base_os = None + self.platform = None + self.platform_version = None + self.environment_variables = None + self.pre_build_steps = None + + +class ContainerAppsBuildResource(ProxyResource): + """Information pertaining to an individual build. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData + :ivar provisioning_state: Build provisioning state. Known values are: "Succeeded", "Failed", + "Canceled", "Creating", "Updating", and "Deleting". + :vartype provisioning_state: str or ~azure.mgmt.appcontainers.models.BuildProvisioningState + :ivar build_status: Status of the build once it has been provisioned. Known values are: + "NotStarted", "InProgress", "Succeeded", "Canceled", and "Failed". + :vartype build_status: str or ~azure.mgmt.appcontainers.models.BuildStatus + :ivar destination_container_registry: Container registry that the final image will be uploaded + to. + :vartype destination_container_registry: + ~azure.mgmt.appcontainers.models.ContainerRegistryWithCustomImage + :ivar configuration: Configuration of the build. + :vartype configuration: ~azure.mgmt.appcontainers.models.ContainerAppsBuildConfiguration + :ivar log_stream_endpoint: Endpoint from which the build logs can be streamed. + :vartype log_stream_endpoint: str + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "build_status": {"readonly": True}, + "destination_container_registry": {"readonly": True}, + "configuration": {"readonly": True}, + "log_stream_endpoint": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "build_status": {"key": "properties.buildStatus", "type": "str"}, + "destination_container_registry": { + "key": "properties.destinationContainerRegistry", + "type": "ContainerRegistryWithCustomImage", + }, + "configuration": {"key": "properties.configuration", "type": "ContainerAppsBuildConfiguration"}, + "log_stream_endpoint": {"key": "properties.logStreamEndpoint", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.provisioning_state = None + self.build_status = None + self.destination_container_registry = None + self.configuration = None + self.log_stream_endpoint = None + + class ContainerAppSecret(_serialization.Model): """Container App Secret. @@ -2545,6 +3408,165 @@ def __init__(self, **kwargs: Any) -> None: self.key_vault_url = None +class ContainerAppsPatchResource(ProxyResource): + """Container App Patch. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData + :ivar properties: Properties that describes current states of the patch resource. + :vartype properties: ~azure.mgmt.appcontainers.models.PatchProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "properties": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "properties": {"key": "properties", "type": "PatchProperties"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.properties = None + + +class ContainerExecutionStatus(_serialization.Model): + """Container Apps Job execution container status. Contains status code and reason. + + :ivar name: Container Name. + :vartype name: str + :ivar code: Exit code. + :vartype code: int + :ivar additional_information: Additional information for the container status. + :vartype additional_information: str + :ivar status: Status of the container. + :vartype status: str + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "code": {"key": "code", "type": "int"}, + "additional_information": {"key": "additionalInformation", "type": "str"}, + "status": {"key": "status", "type": "str"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + code: Optional[int] = None, + additional_information: Optional[str] = None, + status: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: Container Name. + :paramtype name: str + :keyword code: Exit code. + :paramtype code: int + :keyword additional_information: Additional information for the container status. + :paramtype additional_information: str + :keyword status: Status of the container. + :paramtype status: str + """ + super().__init__(**kwargs) + self.name = name + self.code = code + self.additional_information = additional_information + self.status = status + + +class ContainerRegistry(_serialization.Model): + """Model representing a mapping from a container registry to the identity used to connect to it. + + All required parameters must be populated in order to send to server. + + :ivar container_registry_server: Login server of the container registry. Required. + :vartype container_registry_server: str + :ivar identity_resource_id: Resource ID of the managed identity. Required. + :vartype identity_resource_id: str + """ + + _validation = { + "container_registry_server": {"required": True}, + "identity_resource_id": {"required": True}, + } + + _attribute_map = { + "container_registry_server": {"key": "containerRegistryServer", "type": "str"}, + "identity_resource_id": {"key": "identityResourceId", "type": "str"}, + } + + def __init__(self, *, container_registry_server: str, identity_resource_id: str, **kwargs: Any) -> None: + """ + :keyword container_registry_server: Login server of the container registry. Required. + :paramtype container_registry_server: str + :keyword identity_resource_id: Resource ID of the managed identity. Required. + :paramtype identity_resource_id: str + """ + super().__init__(**kwargs) + self.container_registry_server = container_registry_server + self.identity_resource_id = identity_resource_id + + +class ContainerRegistryWithCustomImage(_serialization.Model): + """Container registry that the final image will be uploaded to. + + All required parameters must be populated in order to send to server. + + :ivar server: Login server of the container registry that the final image should be uploaded + to. Builder resource needs to have this container registry defined along with an identity to + use to access it. Required. + :vartype server: str + :ivar image: Full name that the final image should be uploaded as, including both image name + and tag. + :vartype image: str + """ + + _validation = { + "server": {"required": True}, + } + + _attribute_map = { + "server": {"key": "server", "type": "str"}, + "image": {"key": "image", "type": "str"}, + } + + def __init__(self, *, server: str, image: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword server: Login server of the container registry that the final image should be uploaded + to. Builder resource needs to have this container registry defined along with an identity to + use to access it. Required. + :paramtype server: str + :keyword image: Full name that the final image should be uploaded as, including both image name + and tag. + :paramtype image: str + """ + super().__init__(**kwargs) + self.server = server + self.image = image + + class ContainerResources(_serialization.Model): """Container App container resource requirements. @@ -2685,6 +3707,47 @@ def __init__( self.allow_credentials = allow_credentials +class CustomContainerTemplate(_serialization.Model): + """Custom container configuration. + + :ivar registry_credentials: Private container registry credentials for containers used by the + sessions of the session pool. + :vartype registry_credentials: ~azure.mgmt.appcontainers.models.SessionRegistryCredentials + :ivar containers: List of container definitions for the sessions of the session pool. + :vartype containers: list[~azure.mgmt.appcontainers.models.SessionContainer] + :ivar ingress: Session pool ingress configuration. + :vartype ingress: ~azure.mgmt.appcontainers.models.SessionIngress + """ + + _attribute_map = { + "registry_credentials": {"key": "registryCredentials", "type": "SessionRegistryCredentials"}, + "containers": {"key": "containers", "type": "[SessionContainer]"}, + "ingress": {"key": "ingress", "type": "SessionIngress"}, + } + + def __init__( + self, + *, + registry_credentials: Optional["_models.SessionRegistryCredentials"] = None, + containers: Optional[List["_models.SessionContainer"]] = None, + ingress: Optional["_models.SessionIngress"] = None, + **kwargs: Any + ) -> None: + """ + :keyword registry_credentials: Private container registry credentials for containers used by + the sessions of the session pool. + :paramtype registry_credentials: ~azure.mgmt.appcontainers.models.SessionRegistryCredentials + :keyword containers: List of container definitions for the sessions of the session pool. + :paramtype containers: list[~azure.mgmt.appcontainers.models.SessionContainer] + :keyword ingress: Session pool ingress configuration. + :paramtype ingress: ~azure.mgmt.appcontainers.models.SessionIngress + """ + super().__init__(**kwargs) + self.registry_credentials = registry_credentials + self.containers = containers + self.ingress = ingress + + class CustomDomain(_serialization.Model): """Custom Domain of a Container App. @@ -2742,6 +3805,9 @@ class CustomDomainConfiguration(_serialization.Model): :vartype custom_domain_verification_id: str :ivar dns_suffix: Dns suffix for the environment domain. :vartype dns_suffix: str + :ivar certificate_key_vault_properties: Certificate stored in Azure Key Vault. + :vartype certificate_key_vault_properties: + ~azure.mgmt.appcontainers.models.CertificateKeyVaultProperties :ivar certificate_value: PFX or PEM blob. :vartype certificate_value: bytes :ivar certificate_password: Certificate password. @@ -2764,6 +3830,10 @@ class CustomDomainConfiguration(_serialization.Model): _attribute_map = { "custom_domain_verification_id": {"key": "customDomainVerificationId", "type": "str"}, "dns_suffix": {"key": "dnsSuffix", "type": "str"}, + "certificate_key_vault_properties": { + "key": "certificateKeyVaultProperties", + "type": "CertificateKeyVaultProperties", + }, "certificate_value": {"key": "certificateValue", "type": "bytearray"}, "certificate_password": {"key": "certificatePassword", "type": "str"}, "expiration_date": {"key": "expirationDate", "type": "iso-8601"}, @@ -2775,6 +3845,7 @@ def __init__( self, *, dns_suffix: Optional[str] = None, + certificate_key_vault_properties: Optional["_models.CertificateKeyVaultProperties"] = None, certificate_value: Optional[bytes] = None, certificate_password: Optional[str] = None, **kwargs: Any @@ -2782,6 +3853,9 @@ def __init__( """ :keyword dns_suffix: Dns suffix for the environment domain. :paramtype dns_suffix: str + :keyword certificate_key_vault_properties: Certificate stored in Azure Key Vault. + :paramtype certificate_key_vault_properties: + ~azure.mgmt.appcontainers.models.CertificateKeyVaultProperties :keyword certificate_value: PFX or PEM blob. :paramtype certificate_value: bytes :keyword certificate_password: Certificate password. @@ -2790,6 +3864,7 @@ def __init__( super().__init__(**kwargs) self.custom_domain_verification_id = None self.dns_suffix = dns_suffix + self.certificate_key_vault_properties = certificate_key_vault_properties self.certificate_value = certificate_value self.certificate_password = certificate_password self.expiration_date = None @@ -3046,12 +4121,16 @@ class CustomScaleRule(_serialization.Model): :vartype metadata: dict[str, str] :ivar auth: Authentication secrets for the custom scale rule. :vartype auth: list[~azure.mgmt.appcontainers.models.ScaleRuleAuth] + :ivar identity: The resource ID of a user-assigned managed identity that is assigned to the + Container App, or 'system' for system-assigned identity. + :vartype identity: str """ _attribute_map = { "type": {"key": "type", "type": "str"}, "metadata": {"key": "metadata", "type": "{str}"}, "auth": {"key": "auth", "type": "[ScaleRuleAuth]"}, + "identity": {"key": "identity", "type": "str"}, } def __init__( @@ -3060,6 +4139,7 @@ def __init__( type: Optional[str] = None, metadata: Optional[Dict[str, str]] = None, auth: Optional[List["_models.ScaleRuleAuth"]] = None, + identity: Optional[str] = None, **kwargs: Any ) -> None: """ @@ -3070,11 +4150,15 @@ def __init__( :paramtype metadata: dict[str, str] :keyword auth: Authentication secrets for the custom scale rule. :paramtype auth: list[~azure.mgmt.appcontainers.models.ScaleRuleAuth] + :keyword identity: The resource ID of a user-assigned managed identity that is assigned to the + Container App, or 'system' for system-assigned identity. + :paramtype identity: str """ super().__init__(**kwargs) self.type = type self.metadata = metadata self.auth = auth + self.identity = identity class Dapr(_serialization.Model): @@ -3164,8 +4248,8 @@ class DaprComponent(ProxyResource): # pylint: disable=too-many-instance-attribu Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -3191,6 +4275,10 @@ class DaprComponent(ProxyResource): # pylint: disable=too-many-instance-attribu :vartype metadata: list[~azure.mgmt.appcontainers.models.DaprMetadata] :ivar scopes: Names of container apps that can use this Dapr component. :vartype scopes: list[str] + :ivar service_component_bind: List of container app services that are bound to the Dapr + component. + :vartype service_component_bind: + list[~azure.mgmt.appcontainers.models.DaprComponentServiceBinding] """ _validation = { @@ -3213,6 +4301,7 @@ class DaprComponent(ProxyResource): # pylint: disable=too-many-instance-attribu "secret_store_component": {"key": "properties.secretStoreComponent", "type": "str"}, "metadata": {"key": "properties.metadata", "type": "[DaprMetadata]"}, "scopes": {"key": "properties.scopes", "type": "[str]"}, + "service_component_bind": {"key": "properties.serviceComponentBind", "type": "[DaprComponentServiceBinding]"}, } def __init__( @@ -3226,6 +4315,7 @@ def __init__( secret_store_component: Optional[str] = None, metadata: Optional[List["_models.DaprMetadata"]] = None, scopes: Optional[List[str]] = None, + service_component_bind: Optional[List["_models.DaprComponentServiceBinding"]] = None, **kwargs: Any ) -> None: """ @@ -3245,6 +4335,10 @@ def __init__( :paramtype metadata: list[~azure.mgmt.appcontainers.models.DaprMetadata] :keyword scopes: Names of container apps that can use this Dapr component. :paramtype scopes: list[str] + :keyword service_component_bind: List of container app services that are bound to the Dapr + component. + :paramtype service_component_bind: + list[~azure.mgmt.appcontainers.models.DaprComponentServiceBinding] """ super().__init__(**kwargs) self.component_type = component_type @@ -3255,17 +4349,18 @@ def __init__( self.secret_store_component = secret_store_component self.metadata = metadata self.scopes = scopes + self.service_component_bind = service_component_bind -class DaprComponentsCollection(_serialization.Model): - """Dapr Components ARM resource. +class DaprComponentResiliencyPoliciesCollection(_serialization.Model): # pylint: disable=name-too-long + """Dapr Component Resiliency Policies ARM resource. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to server. :ivar value: Collection of resources. Required. - :vartype value: list[~azure.mgmt.appcontainers.models.DaprComponent] + :vartype value: list[~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicy] :ivar next_link: Link to next page of resources. :vartype next_link: str """ @@ -3276,35 +4371,357 @@ class DaprComponentsCollection(_serialization.Model): } _attribute_map = { - "value": {"key": "value", "type": "[DaprComponent]"}, + "value": {"key": "value", "type": "[DaprComponentResiliencyPolicy]"}, "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: List["_models.DaprComponent"], **kwargs: Any) -> None: + def __init__(self, *, value: List["_models.DaprComponentResiliencyPolicy"], **kwargs: Any) -> None: """ :keyword value: Collection of resources. Required. - :paramtype value: list[~azure.mgmt.appcontainers.models.DaprComponent] + :paramtype value: list[~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicy] """ super().__init__(**kwargs) self.value = value self.next_link = None -class DaprConfiguration(_serialization.Model): - """Configuration properties Dapr component. +class DaprComponentResiliencyPolicy(ProxyResource): + """Dapr Component Resiliency Policy. Variables are only populated by the server, and will be ignored when sending a request. - :ivar version: The version of Dapr. - :vartype version: str + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData + :ivar inbound_policy: The optional inbound component resiliency policy configuration. + :vartype inbound_policy: + ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicyConfiguration + :ivar outbound_policy: The optional outbound component resiliency policy configuration. + :vartype outbound_policy: + ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicyConfiguration """ _validation = { - "version": {"readonly": True}, + "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, + *, + inbound_policy: Optional["_models.DaprComponentResiliencyPolicyConfiguration"] = None, + outbound_policy: Optional["_models.DaprComponentResiliencyPolicyConfiguration"] = None, + **kwargs: Any + ) -> None: + """ + :keyword inbound_policy: The optional inbound component resiliency policy configuration. + :paramtype inbound_policy: + ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicyConfiguration + :keyword outbound_policy: The optional outbound component resiliency policy configuration. + :paramtype outbound_policy: + ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicyConfiguration + """ + super().__init__(**kwargs) + self.inbound_policy = inbound_policy + self.outbound_policy = outbound_policy + + +class DaprComponentResiliencyPolicyCircuitBreakerPolicyConfiguration( + _serialization.Model +): # pylint: disable=name-too-long + """Dapr Component Resiliency Policy Circuit Breaker Policy Configuration. + + :ivar consecutive_errors: The number of consecutive errors before the circuit is opened. + :vartype consecutive_errors: int + :ivar timeout_in_seconds: The interval in seconds until a retry attempt is made after the + circuit is opened. + :vartype timeout_in_seconds: int + :ivar interval_in_seconds: The optional interval in seconds after which the error count resets + to 0. An interval of 0 will never reset. If not specified, the timeoutInSeconds value will be + used. + :vartype interval_in_seconds: int + """ + + _attribute_map = { + "consecutive_errors": {"key": "consecutiveErrors", "type": "int"}, + "timeout_in_seconds": {"key": "timeoutInSeconds", "type": "int"}, + "interval_in_seconds": {"key": "intervalInSeconds", "type": "int"}, + } + + def __init__( + self, + *, + consecutive_errors: Optional[int] = None, + timeout_in_seconds: Optional[int] = None, + interval_in_seconds: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword consecutive_errors: The number of consecutive errors before the circuit is opened. + :paramtype consecutive_errors: int + :keyword timeout_in_seconds: The interval in seconds until a retry attempt is made after the + circuit is opened. + :paramtype timeout_in_seconds: int + :keyword interval_in_seconds: The optional interval in seconds after which the error count + resets to 0. An interval of 0 will never reset. If not specified, the timeoutInSeconds value + will be used. + :paramtype interval_in_seconds: int + """ + super().__init__(**kwargs) + self.consecutive_errors = consecutive_errors + self.timeout_in_seconds = timeout_in_seconds + self.interval_in_seconds = interval_in_seconds + + +class DaprComponentResiliencyPolicyConfiguration(_serialization.Model): # pylint: disable=name-too-long + """Dapr Component Resiliency Policy Configuration. + + :ivar http_retry_policy: The optional HTTP retry policy configuration. + :vartype http_retry_policy: + ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicyHttpRetryPolicyConfiguration + :ivar timeout_policy: The optional timeout policy configuration. + :vartype timeout_policy: + ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicyTimeoutPolicyConfiguration + :ivar circuit_breaker_policy: The optional circuit breaker policy configuration. + :vartype circuit_breaker_policy: + ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicyCircuitBreakerPolicyConfiguration + """ + + _attribute_map = { + "http_retry_policy": { + "key": "httpRetryPolicy", + "type": "DaprComponentResiliencyPolicyHttpRetryPolicyConfiguration", + }, + "timeout_policy": {"key": "timeoutPolicy", "type": "DaprComponentResiliencyPolicyTimeoutPolicyConfiguration"}, + "circuit_breaker_policy": { + "key": "circuitBreakerPolicy", + "type": "DaprComponentResiliencyPolicyCircuitBreakerPolicyConfiguration", + }, + } + + def __init__( + self, + *, + http_retry_policy: Optional["_models.DaprComponentResiliencyPolicyHttpRetryPolicyConfiguration"] = None, + timeout_policy: Optional["_models.DaprComponentResiliencyPolicyTimeoutPolicyConfiguration"] = None, + circuit_breaker_policy: Optional[ + "_models.DaprComponentResiliencyPolicyCircuitBreakerPolicyConfiguration" + ] = None, + **kwargs: Any + ) -> None: + """ + :keyword http_retry_policy: The optional HTTP retry policy configuration. + :paramtype http_retry_policy: + ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicyHttpRetryPolicyConfiguration + :keyword timeout_policy: The optional timeout policy configuration. + :paramtype timeout_policy: + ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicyTimeoutPolicyConfiguration + :keyword circuit_breaker_policy: The optional circuit breaker policy configuration. + :paramtype circuit_breaker_policy: + ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicyCircuitBreakerPolicyConfiguration + """ + super().__init__(**kwargs) + self.http_retry_policy = http_retry_policy + self.timeout_policy = timeout_policy + self.circuit_breaker_policy = circuit_breaker_policy + + +class DaprComponentResiliencyPolicyHttpRetryBackOffConfiguration(_serialization.Model): # pylint: disable=name-too-long + """Dapr Component Resiliency Policy HTTP Retry Backoff Configuration. + + :ivar initial_delay_in_milliseconds: The optional initial delay in milliseconds before an + operation is retried. + :vartype initial_delay_in_milliseconds: int + :ivar max_interval_in_milliseconds: The optional maximum time interval in milliseconds between + retry attempts. + :vartype max_interval_in_milliseconds: int + """ + + _attribute_map = { + "initial_delay_in_milliseconds": {"key": "initialDelayInMilliseconds", "type": "int"}, + "max_interval_in_milliseconds": {"key": "maxIntervalInMilliseconds", "type": "int"}, + } + + def __init__( + self, + *, + initial_delay_in_milliseconds: Optional[int] = None, + max_interval_in_milliseconds: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword initial_delay_in_milliseconds: The optional initial delay in milliseconds before an + operation is retried. + :paramtype initial_delay_in_milliseconds: int + :keyword max_interval_in_milliseconds: The optional maximum time interval in milliseconds + between retry attempts. + :paramtype max_interval_in_milliseconds: int + """ + super().__init__(**kwargs) + self.initial_delay_in_milliseconds = initial_delay_in_milliseconds + self.max_interval_in_milliseconds = max_interval_in_milliseconds + + +class DaprComponentResiliencyPolicyHttpRetryPolicyConfiguration(_serialization.Model): # pylint: disable=name-too-long + """Dapr Component Resiliency Policy HTTP Retry Policy Configuration. + + :ivar max_retries: The optional maximum number of retries. + :vartype max_retries: int + :ivar retry_back_off: The optional retry backoff configuration. + :vartype retry_back_off: + ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicyHttpRetryBackOffConfiguration + """ + + _attribute_map = { + "max_retries": {"key": "maxRetries", "type": "int"}, + "retry_back_off": {"key": "retryBackOff", "type": "DaprComponentResiliencyPolicyHttpRetryBackOffConfiguration"}, + } + + def __init__( + self, + *, + max_retries: Optional[int] = None, + retry_back_off: Optional["_models.DaprComponentResiliencyPolicyHttpRetryBackOffConfiguration"] = None, + **kwargs: Any + ) -> None: + """ + :keyword max_retries: The optional maximum number of retries. + :paramtype max_retries: int + :keyword retry_back_off: The optional retry backoff configuration. + :paramtype retry_back_off: + ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicyHttpRetryBackOffConfiguration + """ + super().__init__(**kwargs) + self.max_retries = max_retries + self.retry_back_off = retry_back_off + + +class DaprComponentResiliencyPolicyTimeoutPolicyConfiguration(_serialization.Model): # pylint: disable=name-too-long + """Dapr Component Resiliency Policy Timeout Policy Configuration. + + :ivar response_timeout_in_seconds: The optional response timeout in seconds. + :vartype response_timeout_in_seconds: int + """ + + _attribute_map = { + "response_timeout_in_seconds": {"key": "responseTimeoutInSeconds", "type": "int"}, + } + + def __init__(self, *, response_timeout_in_seconds: Optional[int] = None, **kwargs: Any) -> None: + """ + :keyword response_timeout_in_seconds: The optional response timeout in seconds. + :paramtype response_timeout_in_seconds: int + """ + super().__init__(**kwargs) + self.response_timeout_in_seconds = response_timeout_in_seconds + + +class DaprComponentsCollection(_serialization.Model): + """Dapr Components ARM resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar value: Collection of resources. Required. + :vartype value: list[~azure.mgmt.appcontainers.models.DaprComponent] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[DaprComponent]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.DaprComponent"], **kwargs: Any) -> None: + """ + :keyword value: Collection of resources. Required. + :paramtype value: list[~azure.mgmt.appcontainers.models.DaprComponent] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class DaprComponentServiceBinding(_serialization.Model): + """Configuration to bind a Dapr Component to a dev ContainerApp Service. + + :ivar name: Name of the service bind. + :vartype name: str + :ivar service_id: Resource id of the target service. + :vartype service_id: str + :ivar metadata: Service bind metadata. + :vartype metadata: ~azure.mgmt.appcontainers.models.DaprServiceBindMetadata + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "service_id": {"key": "serviceId", "type": "str"}, + "metadata": {"key": "metadata", "type": "DaprServiceBindMetadata"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + service_id: Optional[str] = None, + metadata: Optional["_models.DaprServiceBindMetadata"] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: Name of the service bind. + :paramtype name: str + :keyword service_id: Resource id of the target service. + :paramtype service_id: str + :keyword metadata: Service bind metadata. + :paramtype metadata: ~azure.mgmt.appcontainers.models.DaprServiceBindMetadata + """ + super().__init__(**kwargs) + self.name = name + self.service_id = service_id + self.metadata = metadata + + +class DaprConfiguration(_serialization.Model): + """Configuration properties Dapr component. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar version: The version of Dapr. + :vartype version: str + """ + + _validation = { + "version": {"readonly": True}, + } + + _attribute_map = { + "version": {"key": "version", "type": "str"}, } def __init__(self, **kwargs: Any) -> None: @@ -3408,69 +4825,352 @@ def __init__(self, *, value: List["_models.DaprSecret"], **kwargs: Any) -> None: self.value = value -class DefaultAuthorizationPolicy(_serialization.Model): - """The configuration settings of the Azure Active Directory default authorization policy. +class DaprServiceBindMetadata(_serialization.Model): + """Dapr component metadata. - :ivar allowed_principals: The configuration settings of the Azure Active Directory allowed - principals. - :vartype allowed_principals: ~azure.mgmt.appcontainers.models.AllowedPrincipals - :ivar allowed_applications: The configuration settings of the Azure Active Directory allowed - applications. - :vartype allowed_applications: list[str] + :ivar name: Service bind metadata property name. + :vartype name: str + :ivar value: Service bind metadata property value. + :vartype value: str """ _attribute_map = { - "allowed_principals": {"key": "allowedPrincipals", "type": "AllowedPrincipals"}, - "allowed_applications": {"key": "allowedApplications", "type": "[str]"}, + "name": {"key": "name", "type": "str"}, + "value": {"key": "value", "type": "str"}, } - def __init__( - self, - *, - allowed_principals: Optional["_models.AllowedPrincipals"] = None, - allowed_applications: Optional[List[str]] = None, - **kwargs: Any - ) -> None: + def __init__(self, *, name: Optional[str] = None, value: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword allowed_principals: The configuration settings of the Azure Active Directory allowed - principals. - :paramtype allowed_principals: ~azure.mgmt.appcontainers.models.AllowedPrincipals - :keyword allowed_applications: The configuration settings of the Azure Active Directory allowed - applications. - :paramtype allowed_applications: list[str] + :keyword name: Service bind metadata property name. + :paramtype name: str + :keyword value: Service bind metadata property value. + :paramtype value: str """ super().__init__(**kwargs) - self.allowed_principals = allowed_principals - self.allowed_applications = allowed_applications + self.name = name + self.value = value -class DefaultErrorResponse(_serialization.Model): - """App Service error response. +class DaprSubscription(ProxyResource): # pylint: disable=too-many-instance-attributes + """Dapr PubSub Event Subscription. Variables are only populated by the server, and will be ignored when sending a request. - :ivar error: Error model. - :vartype error: ~azure.mgmt.appcontainers.models.DefaultErrorResponseError + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData + :ivar pubsub_name: Dapr PubSub component name. + :vartype pubsub_name: str + :ivar topic: Topic name. + :vartype topic: str + :ivar dead_letter_topic: Deadletter topic name. + :vartype dead_letter_topic: str + :ivar routes: Subscription routes. + :vartype routes: ~azure.mgmt.appcontainers.models.DaprSubscriptionRoutes + :ivar scopes: Application scopes to restrict the subscription to specific apps. + :vartype scopes: list[str] + :ivar metadata: Subscription metadata. + :vartype metadata: dict[str, str] + :ivar bulk_subscribe: Bulk subscription options. + :vartype bulk_subscribe: ~azure.mgmt.appcontainers.models.DaprSubscriptionBulkSubscribeOptions """ _validation = { - "error": {"readonly": True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, } _attribute_map = { - "error": {"key": "error", "type": "DefaultErrorResponseError"}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "pubsub_name": {"key": "properties.pubsubName", "type": "str"}, + "topic": {"key": "properties.topic", "type": "str"}, + "dead_letter_topic": {"key": "properties.deadLetterTopic", "type": "str"}, + "routes": {"key": "properties.routes", "type": "DaprSubscriptionRoutes"}, + "scopes": {"key": "properties.scopes", "type": "[str]"}, + "metadata": {"key": "properties.metadata", "type": "{str}"}, + "bulk_subscribe": {"key": "properties.bulkSubscribe", "type": "DaprSubscriptionBulkSubscribeOptions"}, } - def __init__(self, **kwargs: Any) -> None: - """ """ + def __init__( + self, + *, + pubsub_name: Optional[str] = None, + topic: Optional[str] = None, + dead_letter_topic: Optional[str] = None, + routes: Optional["_models.DaprSubscriptionRoutes"] = None, + scopes: Optional[List[str]] = None, + metadata: Optional[Dict[str, str]] = None, + bulk_subscribe: Optional["_models.DaprSubscriptionBulkSubscribeOptions"] = None, + **kwargs: Any + ) -> None: + """ + :keyword pubsub_name: Dapr PubSub component name. + :paramtype pubsub_name: str + :keyword topic: Topic name. + :paramtype topic: str + :keyword dead_letter_topic: Deadletter topic name. + :paramtype dead_letter_topic: str + :keyword routes: Subscription routes. + :paramtype routes: ~azure.mgmt.appcontainers.models.DaprSubscriptionRoutes + :keyword scopes: Application scopes to restrict the subscription to specific apps. + :paramtype scopes: list[str] + :keyword metadata: Subscription metadata. + :paramtype metadata: dict[str, str] + :keyword bulk_subscribe: Bulk subscription options. + :paramtype bulk_subscribe: + ~azure.mgmt.appcontainers.models.DaprSubscriptionBulkSubscribeOptions + """ super().__init__(**kwargs) - self.error = None - + self.pubsub_name = pubsub_name + self.topic = topic + self.dead_letter_topic = dead_letter_topic + self.routes = routes + self.scopes = scopes + self.metadata = metadata + self.bulk_subscribe = bulk_subscribe -class DefaultErrorResponseError(_serialization.Model): - """Error model. - Variables are only populated by the server, and will be ignored when sending a request. +class DaprSubscriptionBulkSubscribeOptions(_serialization.Model): + """Dapr PubSub Bulk Subscription Options. + + :ivar enabled: Enable bulk subscription. + :vartype enabled: bool + :ivar max_messages_count: Maximum number of messages to deliver in a bulk message. + :vartype max_messages_count: int + :ivar max_await_duration_ms: Maximum duration in milliseconds to wait before a bulk message is + sent to the app. + :vartype max_await_duration_ms: int + """ + + _attribute_map = { + "enabled": {"key": "enabled", "type": "bool"}, + "max_messages_count": {"key": "maxMessagesCount", "type": "int"}, + "max_await_duration_ms": {"key": "maxAwaitDurationMs", "type": "int"}, + } + + def __init__( + self, + *, + enabled: bool = False, + max_messages_count: Optional[int] = None, + max_await_duration_ms: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword enabled: Enable bulk subscription. + :paramtype enabled: bool + :keyword max_messages_count: Maximum number of messages to deliver in a bulk message. + :paramtype max_messages_count: int + :keyword max_await_duration_ms: Maximum duration in milliseconds to wait before a bulk message + is sent to the app. + :paramtype max_await_duration_ms: int + """ + super().__init__(**kwargs) + self.enabled = enabled + self.max_messages_count = max_messages_count + self.max_await_duration_ms = max_await_duration_ms + + +class DaprSubscriptionRouteRule(_serialization.Model): + """Dapr Pubsub Event Subscription Route Rule is used to specify the condition for sending a + message to a specific path. + + :ivar match: The optional CEL expression used to match the event. If the match is not + specified, then the route is considered the default. The rules are tested in the order + specified, so they should be define from most-to-least specific. The default route should + appear last in the list. + :vartype match: str + :ivar path: The path for events that match this rule. + :vartype path: str + """ + + _attribute_map = { + "match": {"key": "match", "type": "str"}, + "path": {"key": "path", "type": "str"}, + } + + def __init__(self, *, match: Optional[str] = None, path: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword match: The optional CEL expression used to match the event. If the match is not + specified, then the route is considered the default. The rules are tested in the order + specified, so they should be define from most-to-least specific. The default route should + appear last in the list. + :paramtype match: str + :keyword path: The path for events that match this rule. + :paramtype path: str + """ + super().__init__(**kwargs) + self.match = match + self.path = path + + +class DaprSubscriptionRoutes(_serialization.Model): + """Dapr PubSub Event Subscription Routes configuration. + + :ivar rules: The list of Dapr PubSub Event Subscription Route Rules. + :vartype rules: list[~azure.mgmt.appcontainers.models.DaprSubscriptionRouteRule] + :ivar default: The default path to deliver events that do not match any of the rules. + :vartype default: str + """ + + _attribute_map = { + "rules": {"key": "rules", "type": "[DaprSubscriptionRouteRule]"}, + "default": {"key": "default", "type": "str"}, + } + + def __init__( + self, + *, + rules: Optional[List["_models.DaprSubscriptionRouteRule"]] = None, + default: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword rules: The list of Dapr PubSub Event Subscription Route Rules. + :paramtype rules: list[~azure.mgmt.appcontainers.models.DaprSubscriptionRouteRule] + :keyword default: The default path to deliver events that do not match any of the rules. + :paramtype default: str + """ + super().__init__(**kwargs) + self.rules = rules + self.default = default + + +class DaprSubscriptionsCollection(_serialization.Model): + """Dapr Subscriptions ARM resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar value: Collection of resources. Required. + :vartype value: list[~azure.mgmt.appcontainers.models.DaprSubscription] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[DaprSubscription]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.DaprSubscription"], **kwargs: Any) -> None: + """ + :keyword value: Collection of resources. Required. + :paramtype value: list[~azure.mgmt.appcontainers.models.DaprSubscription] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class DataDogConfiguration(_serialization.Model): + """Configuration of datadog. + + :ivar site: The data dog site. + :vartype site: str + :ivar key: The data dog api key. + :vartype key: str + """ + + _attribute_map = { + "site": {"key": "site", "type": "str"}, + "key": {"key": "key", "type": "str"}, + } + + def __init__(self, *, site: Optional[str] = None, key: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword site: The data dog site. + :paramtype site: str + :keyword key: The data dog api key. + :paramtype key: str + """ + super().__init__(**kwargs) + self.site = site + self.key = key + + +class DefaultAuthorizationPolicy(_serialization.Model): + """The configuration settings of the Azure Active Directory default authorization policy. + + :ivar allowed_principals: The configuration settings of the Azure Active Directory allowed + principals. + :vartype allowed_principals: ~azure.mgmt.appcontainers.models.AllowedPrincipals + :ivar allowed_applications: The configuration settings of the Azure Active Directory allowed + applications. + :vartype allowed_applications: list[str] + """ + + _attribute_map = { + "allowed_principals": {"key": "allowedPrincipals", "type": "AllowedPrincipals"}, + "allowed_applications": {"key": "allowedApplications", "type": "[str]"}, + } + + def __init__( + self, + *, + allowed_principals: Optional["_models.AllowedPrincipals"] = None, + allowed_applications: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword allowed_principals: The configuration settings of the Azure Active Directory allowed + principals. + :paramtype allowed_principals: ~azure.mgmt.appcontainers.models.AllowedPrincipals + :keyword allowed_applications: The configuration settings of the Azure Active Directory allowed + applications. + :paramtype allowed_applications: list[str] + """ + super().__init__(**kwargs) + self.allowed_principals = allowed_principals + self.allowed_applications = allowed_applications + + +class DefaultErrorResponse(_serialization.Model): + """App Service error response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar error: Error model. + :vartype error: ~azure.mgmt.appcontainers.models.DefaultErrorResponseError + """ + + _validation = { + "error": {"readonly": True}, + } + + _attribute_map = { + "error": {"key": "error", "type": "DefaultErrorResponseError"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.error = None + + +class DefaultErrorResponseError(_serialization.Model): + """Error model. + + 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 @@ -3547,6 +5247,38 @@ def __init__(self, **kwargs: Any) -> None: self.target = None +class DestinationsConfiguration(_serialization.Model): + """Configuration of Open Telemetry destinations. + + :ivar data_dog_configuration: Open telemetry datadog destination configuration. + :vartype data_dog_configuration: ~azure.mgmt.appcontainers.models.DataDogConfiguration + :ivar otlp_configurations: Open telemetry otlp configurations. + :vartype otlp_configurations: list[~azure.mgmt.appcontainers.models.OtlpConfiguration] + """ + + _attribute_map = { + "data_dog_configuration": {"key": "dataDogConfiguration", "type": "DataDogConfiguration"}, + "otlp_configurations": {"key": "otlpConfigurations", "type": "[OtlpConfiguration]"}, + } + + def __init__( + self, + *, + data_dog_configuration: Optional["_models.DataDogConfiguration"] = None, + otlp_configurations: Optional[List["_models.OtlpConfiguration"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword data_dog_configuration: Open telemetry datadog destination configuration. + :paramtype data_dog_configuration: ~azure.mgmt.appcontainers.models.DataDogConfiguration + :keyword otlp_configurations: Open telemetry otlp configurations. + :paramtype otlp_configurations: list[~azure.mgmt.appcontainers.models.OtlpConfiguration] + """ + super().__init__(**kwargs) + self.data_dog_configuration = data_dog_configuration + self.otlp_configurations = otlp_configurations + + class DiagnosticDataProviderMetadata(_serialization.Model): """Details of a diagnostics data provider. @@ -3736,8 +5468,8 @@ class Diagnostics(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -4014,52 +5746,13 @@ def __init__(self, **kwargs: Any) -> None: self.pes_id = None -class EncryptionSettings(_serialization.Model): - """The configuration settings of the secrets references of encryption key and signing key for - ContainerApp Service Authentication/Authorization. - - :ivar container_app_auth_encryption_secret_name: The secret name which is referenced for - EncryptionKey. - :vartype container_app_auth_encryption_secret_name: str - :ivar container_app_auth_signing_secret_name: The secret name which is referenced for - SigningKey. - :vartype container_app_auth_signing_secret_name: str - """ - - _attribute_map = { - "container_app_auth_encryption_secret_name": {"key": "containerAppAuthEncryptionSecretName", "type": "str"}, - "container_app_auth_signing_secret_name": {"key": "containerAppAuthSigningSecretName", "type": "str"}, - } - - def __init__( - self, - *, - container_app_auth_encryption_secret_name: Optional[str] = None, - container_app_auth_signing_secret_name: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword container_app_auth_encryption_secret_name: The secret name which is referenced for - EncryptionKey. - :paramtype container_app_auth_encryption_secret_name: str - :keyword container_app_auth_signing_secret_name: The secret name which is referenced for - SigningKey. - :paramtype container_app_auth_signing_secret_name: str - """ - super().__init__(**kwargs) - self.container_app_auth_encryption_secret_name = container_app_auth_encryption_secret_name - self.container_app_auth_signing_secret_name = container_app_auth_signing_secret_name - - -class EnvironmentAuthToken(TrackedResource): - """Environment Auth Token. +class DotNetComponent(ProxyResource): + """.NET Component. Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to server. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -4069,14 +5762,17 @@ class EnvironmentAuthToken(TrackedResource): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar token: Auth token value. - :vartype token: str - :ivar expires: Token expiration date. - :vartype expires: ~datetime.datetime + :ivar component_type: Type of the .NET Component. "AspireDashboard" + :vartype component_type: str or ~azure.mgmt.appcontainers.models.DotNetComponentType + :ivar provisioning_state: Provisioning state of the .NET Component. Known values are: + "Succeeded", "Failed", "Canceled", "Deleting", and "InProgress". + :vartype provisioning_state: str or + ~azure.mgmt.appcontainers.models.DotNetComponentProvisioningState + :ivar configurations: List of .NET Components configuration properties. + :vartype configurations: + list[~azure.mgmt.appcontainers.models.DotNetComponentConfigurationProperty] + :ivar service_binds: List of .NET Components that are bound to the .NET component. + :vartype service_binds: list[~azure.mgmt.appcontainers.models.DotNetComponentServiceBind] """ _validation = { @@ -4084,9 +5780,7 @@ class EnvironmentAuthToken(TrackedResource): "name": {"readonly": True}, "type": {"readonly": True}, "system_data": {"readonly": True}, - "location": {"required": True}, - "token": {"readonly": True}, - "expires": {"readonly": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { @@ -4094,30 +5788,257 @@ class EnvironmentAuthToken(TrackedResource): "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, "system_data": {"key": "systemData", "type": "SystemData"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "token": {"key": "properties.token", "type": "str"}, - "expires": {"key": "properties.expires", "type": "iso-8601"}, + "component_type": {"key": "properties.componentType", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "configurations": {"key": "properties.configurations", "type": "[DotNetComponentConfigurationProperty]"}, + "service_binds": {"key": "properties.serviceBinds", "type": "[DotNetComponentServiceBind]"}, } - def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: + def __init__( + self, + *, + component_type: Optional[Union[str, "_models.DotNetComponentType"]] = None, + configurations: Optional[List["_models.DotNetComponentConfigurationProperty"]] = None, + service_binds: Optional[List["_models.DotNetComponentServiceBind"]] = None, + **kwargs: Any + ) -> None: """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str + :keyword component_type: Type of the .NET Component. "AspireDashboard" + :paramtype component_type: str or ~azure.mgmt.appcontainers.models.DotNetComponentType + :keyword configurations: List of .NET Components configuration properties. + :paramtype configurations: + list[~azure.mgmt.appcontainers.models.DotNetComponentConfigurationProperty] + :keyword service_binds: List of .NET Components that are bound to the .NET component. + :paramtype service_binds: list[~azure.mgmt.appcontainers.models.DotNetComponentServiceBind] """ - super().__init__(tags=tags, location=location, **kwargs) - self.token = None - self.expires = None + super().__init__(**kwargs) + self.component_type = component_type + self.provisioning_state = None + self.configurations = configurations + self.service_binds = service_binds -class EnvironmentVar(_serialization.Model): - """Container App container environment variable. +class DotNetComponentConfigurationProperty(_serialization.Model): + """Configuration properties for a .NET Component. - :ivar name: Environment variable name. - :vartype name: str - :ivar value: Non-secret environment variable value. + :ivar property_name: The name of the property. + :vartype property_name: str + :ivar value: The value of the property. + :vartype value: str + """ + + _attribute_map = { + "property_name": {"key": "propertyName", "type": "str"}, + "value": {"key": "value", "type": "str"}, + } + + def __init__(self, *, property_name: Optional[str] = None, value: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword property_name: The name of the property. + :paramtype property_name: str + :keyword value: The value of the property. + :paramtype value: str + """ + super().__init__(**kwargs) + self.property_name = property_name + self.value = value + + +class DotNetComponentsCollection(_serialization.Model): + """.NET Components ARM resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar value: Collection of resources. Required. + :vartype value: list[~azure.mgmt.appcontainers.models.DotNetComponent] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[DotNetComponent]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.DotNetComponent"], **kwargs: Any) -> None: + """ + :keyword value: Collection of resources. Required. + :paramtype value: list[~azure.mgmt.appcontainers.models.DotNetComponent] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class DotNetComponentServiceBind(_serialization.Model): + """Configuration to bind a .NET Component to another .NET Component. + + :ivar name: Name of the service bind. + :vartype name: str + :ivar service_id: Resource id of the target service. + :vartype service_id: str + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "service_id": {"key": "serviceId", "type": "str"}, + } + + def __init__(self, *, name: Optional[str] = None, service_id: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword name: Name of the service bind. + :paramtype name: str + :keyword service_id: Resource id of the target service. + :paramtype service_id: str + """ + super().__init__(**kwargs) + self.name = name + self.service_id = service_id + + +class DynamicPoolConfiguration(_serialization.Model): + """Dynamic pool configuration. + + :ivar execution_type: The execution type of the session pool. "Timed" + :vartype execution_type: str or ~azure.mgmt.appcontainers.models.ExecutionType + :ivar cooldown_period_in_seconds: The cooldown period of a session in seconds. + :vartype cooldown_period_in_seconds: int + """ + + _attribute_map = { + "execution_type": {"key": "executionType", "type": "str"}, + "cooldown_period_in_seconds": {"key": "cooldownPeriodInSeconds", "type": "int"}, + } + + def __init__( + self, + *, + execution_type: Optional[Union[str, "_models.ExecutionType"]] = None, + cooldown_period_in_seconds: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword execution_type: The execution type of the session pool. "Timed" + :paramtype execution_type: str or ~azure.mgmt.appcontainers.models.ExecutionType + :keyword cooldown_period_in_seconds: The cooldown period of a session in seconds. + :paramtype cooldown_period_in_seconds: int + """ + super().__init__(**kwargs) + self.execution_type = execution_type + self.cooldown_period_in_seconds = cooldown_period_in_seconds + + +class EncryptionSettings(_serialization.Model): + """The configuration settings of the secrets references of encryption key and signing key for + ContainerApp Service Authentication/Authorization. + + :ivar container_app_auth_encryption_secret_name: The secret name which is referenced for + EncryptionKey. + :vartype container_app_auth_encryption_secret_name: str + :ivar container_app_auth_signing_secret_name: The secret name which is referenced for + SigningKey. + :vartype container_app_auth_signing_secret_name: str + """ + + _attribute_map = { + "container_app_auth_encryption_secret_name": {"key": "containerAppAuthEncryptionSecretName", "type": "str"}, + "container_app_auth_signing_secret_name": {"key": "containerAppAuthSigningSecretName", "type": "str"}, + } + + def __init__( + self, + *, + container_app_auth_encryption_secret_name: Optional[str] = None, + container_app_auth_signing_secret_name: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword container_app_auth_encryption_secret_name: The secret name which is referenced for + EncryptionKey. + :paramtype container_app_auth_encryption_secret_name: str + :keyword container_app_auth_signing_secret_name: The secret name which is referenced for + SigningKey. + :paramtype container_app_auth_signing_secret_name: str + """ + super().__init__(**kwargs) + self.container_app_auth_encryption_secret_name = container_app_auth_encryption_secret_name + self.container_app_auth_signing_secret_name = container_app_auth_signing_secret_name + + +class EnvironmentAuthToken(TrackedResource): + """Environment Auth Token. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar token: Auth token value. + :vartype token: str + :ivar expires: Token expiration date. + :vartype expires: ~datetime.datetime + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, + "token": {"readonly": True}, + "expires": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "token": {"key": "properties.token", "type": "str"}, + "expires": {"key": "properties.expires", "type": "iso-8601"}, + } + + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str + """ + super().__init__(tags=tags, location=location, **kwargs) + self.token = None + self.expires = None + + +class EnvironmentVar(_serialization.Model): + """Container App container environment variable. + + :ivar name: Environment variable name. + :vartype name: str + :ivar value: Non-secret environment variable value. :vartype value: str :ivar secret_ref: Name of the Container App secret from which to pull the environment variable value. @@ -4153,6 +6074,39 @@ def __init__( self.secret_ref = secret_ref +class EnvironmentVariable(_serialization.Model): + """Model representing an environment variable. + + All required parameters must be populated in order to send to server. + + :ivar name: Environment variable name. Required. + :vartype name: str + :ivar value: Environment variable value. Required. + :vartype value: str + """ + + _validation = { + "name": {"required": True}, + "value": {"required": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "value": {"key": "value", "type": "str"}, + } + + def __init__(self, *, name: str, value: str, **kwargs: Any) -> None: + """ + :keyword name: Environment variable name. Required. + :paramtype name: str + :keyword value: Environment variable value. Required. + :paramtype value: str + """ + super().__init__(**kwargs) + self.name = name + self.value = value + + class ErrorAdditionalInfo(_serialization.Model): """The resource management error additional info. @@ -4224,6 +6178,80 @@ def __init__(self, **kwargs: Any) -> None: self.additional_info = None +class ErrorEntity(_serialization.Model): + """Body of the error response returned from the API. + + :ivar extended_code: Type of error. + :vartype extended_code: str + :ivar message_template: Message template. + :vartype message_template: str + :ivar parameters: Parameters for the template. + :vartype parameters: list[str] + :ivar inner_errors: Inner errors. + :vartype inner_errors: list[~azure.mgmt.appcontainers.models.ErrorEntity] + :ivar details: Error Details. + :vartype details: list[~azure.mgmt.appcontainers.models.ErrorEntity] + :ivar target: The error target. + :vartype target: str + :ivar code: Basic error code. + :vartype code: str + :ivar message: Any details of the error. + :vartype message: str + """ + + _attribute_map = { + "extended_code": {"key": "extendedCode", "type": "str"}, + "message_template": {"key": "messageTemplate", "type": "str"}, + "parameters": {"key": "parameters", "type": "[str]"}, + "inner_errors": {"key": "innerErrors", "type": "[ErrorEntity]"}, + "details": {"key": "details", "type": "[ErrorEntity]"}, + "target": {"key": "target", "type": "str"}, + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + } + + def __init__( + self, + *, + extended_code: Optional[str] = None, + message_template: Optional[str] = None, + parameters: Optional[List[str]] = None, + inner_errors: Optional[List["_models.ErrorEntity"]] = None, + details: Optional[List["_models.ErrorEntity"]] = None, + target: Optional[str] = None, + code: Optional[str] = None, + message: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword extended_code: Type of error. + :paramtype extended_code: str + :keyword message_template: Message template. + :paramtype message_template: str + :keyword parameters: Parameters for the template. + :paramtype parameters: list[str] + :keyword inner_errors: Inner errors. + :paramtype inner_errors: list[~azure.mgmt.appcontainers.models.ErrorEntity] + :keyword details: Error Details. + :paramtype details: list[~azure.mgmt.appcontainers.models.ErrorEntity] + :keyword target: The error target. + :paramtype target: str + :keyword code: Basic error code. + :paramtype code: str + :keyword message: Any details of the error. + :paramtype message: str + """ + super().__init__(**kwargs) + self.extended_code = extended_code + self.message_template = message_template + self.parameters = parameters + self.inner_errors = inner_errors + self.details = details + self.target = target + self.code = code + self.message = message + + class ErrorResponse(_serialization.Model): """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). @@ -4245,6 +6273,26 @@ def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: A self.error = error +class ExecutionStatus(_serialization.Model): + """Container Apps Job execution status. + + :ivar replicas: Replicas in the execution. + :vartype replicas: list[~azure.mgmt.appcontainers.models.ReplicaExecutionStatus] + """ + + _attribute_map = { + "replicas": {"key": "replicas", "type": "[ReplicaExecutionStatus]"}, + } + + def __init__(self, *, replicas: Optional[List["_models.ReplicaExecutionStatus"]] = None, **kwargs: Any) -> None: + """ + :keyword replicas: Replicas in the execution. + :paramtype replicas: list[~azure.mgmt.appcontainers.models.ReplicaExecutionStatus] + """ + super().__init__(**kwargs) + self.replicas = replicas + + class ExtendedLocation(_serialization.Model): """The complex type of the extended location. @@ -4410,7 +6458,7 @@ def __init__( self.login = login -class GithubActionConfiguration(_serialization.Model): +class GithubActionConfiguration(_serialization.Model): # pylint: disable=too-many-instance-attributes """Configuration properties that define the mutable settings of a Container App SourceControl. :ivar registry_info: Registry configurations. @@ -4419,6 +6467,8 @@ class GithubActionConfiguration(_serialization.Model): :vartype azure_credentials: ~azure.mgmt.appcontainers.models.AzureCredentials :ivar context_path: Context path. :vartype context_path: str + :ivar dockerfile_path: Dockerfile path. + :vartype dockerfile_path: str :ivar github_personal_access_token: One time Github PAT to configure github environment. :vartype github_personal_access_token: str :ivar image: Image name. @@ -4431,18 +6481,23 @@ class GithubActionConfiguration(_serialization.Model): :vartype runtime_stack: str :ivar runtime_version: Runtime version. :vartype runtime_version: str + :ivar build_environment_variables: List of environment variables to be passed to the build. + :vartype build_environment_variables: + list[~azure.mgmt.appcontainers.models.EnvironmentVariable] """ _attribute_map = { "registry_info": {"key": "registryInfo", "type": "RegistryInfo"}, "azure_credentials": {"key": "azureCredentials", "type": "AzureCredentials"}, "context_path": {"key": "contextPath", "type": "str"}, + "dockerfile_path": {"key": "dockerfilePath", "type": "str"}, "github_personal_access_token": {"key": "githubPersonalAccessToken", "type": "str"}, "image": {"key": "image", "type": "str"}, "publish_type": {"key": "publishType", "type": "str"}, "os": {"key": "os", "type": "str"}, "runtime_stack": {"key": "runtimeStack", "type": "str"}, "runtime_version": {"key": "runtimeVersion", "type": "str"}, + "build_environment_variables": {"key": "buildEnvironmentVariables", "type": "[EnvironmentVariable]"}, } def __init__( @@ -4451,12 +6506,14 @@ def __init__( registry_info: Optional["_models.RegistryInfo"] = None, azure_credentials: Optional["_models.AzureCredentials"] = None, context_path: Optional[str] = None, + dockerfile_path: Optional[str] = None, github_personal_access_token: Optional[str] = None, image: Optional[str] = None, publish_type: Optional[str] = None, os: Optional[str] = None, runtime_stack: Optional[str] = None, runtime_version: Optional[str] = None, + build_environment_variables: Optional[List["_models.EnvironmentVariable"]] = None, **kwargs: Any ) -> None: """ @@ -4466,6 +6523,8 @@ def __init__( :paramtype azure_credentials: ~azure.mgmt.appcontainers.models.AzureCredentials :keyword context_path: Context path. :paramtype context_path: str + :keyword dockerfile_path: Dockerfile path. + :paramtype dockerfile_path: str :keyword github_personal_access_token: One time Github PAT to configure github environment. :paramtype github_personal_access_token: str :keyword image: Image name. @@ -4478,17 +6537,22 @@ def __init__( :paramtype runtime_stack: str :keyword runtime_version: Runtime version. :paramtype runtime_version: str + :keyword build_environment_variables: List of environment variables to be passed to the build. + :paramtype build_environment_variables: + list[~azure.mgmt.appcontainers.models.EnvironmentVariable] """ super().__init__(**kwargs) self.registry_info = registry_info self.azure_credentials = azure_credentials self.context_path = context_path + self.dockerfile_path = dockerfile_path self.github_personal_access_token = github_personal_access_token self.image = image self.publish_type = publish_type self.os = os self.runtime_stack = runtime_stack self.runtime_version = runtime_version + self.build_environment_variables = build_environment_variables class GlobalValidation(_serialization.Model): @@ -4598,18 +6662,234 @@ def __init__( self.validation = validation -class HttpScaleRule(_serialization.Model): - """Container App container Http scaling rule. +class Header(_serialization.Model): + """Header of otlp configuration. - :ivar metadata: Metadata properties to describe http scale rule. - :vartype metadata: dict[str, str] - :ivar auth: Authentication secrets for the custom scale rule. - :vartype auth: list[~azure.mgmt.appcontainers.models.ScaleRuleAuth] + :ivar key: The key of otlp configuration header. + :vartype key: str + :ivar value: The value of otlp configuration header. + :vartype value: str """ _attribute_map = { - "metadata": {"key": "metadata", "type": "{str}"}, - "auth": {"key": "auth", "type": "[ScaleRuleAuth]"}, + "key": {"key": "key", "type": "str"}, + "value": {"key": "value", "type": "str"}, + } + + def __init__(self, *, key: Optional[str] = None, value: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword key: The key of otlp configuration header. + :paramtype key: str + :keyword value: The value of otlp configuration header. + :paramtype value: str + """ + super().__init__(**kwargs) + self.key = key + self.value = value + + +class HeaderMatch(_serialization.Model): + """Conditions required to match a header. + + :ivar header: Name of the header. + :vartype header: str + :ivar exact_match: Exact value of the header. + :vartype exact_match: str + :ivar prefix_match: Prefix value of the header. + :vartype prefix_match: str + :ivar suffix_match: Suffix value of the header. + :vartype suffix_match: str + :ivar regex_match: Regex value of the header. + :vartype regex_match: str + """ + + _attribute_map = { + "header": {"key": "header", "type": "str"}, + "exact_match": {"key": "match.exactMatch", "type": "str"}, + "prefix_match": {"key": "match.prefixMatch", "type": "str"}, + "suffix_match": {"key": "match.suffixMatch", "type": "str"}, + "regex_match": {"key": "match.regexMatch", "type": "str"}, + } + + def __init__( + self, + *, + header: Optional[str] = None, + exact_match: Optional[str] = None, + prefix_match: Optional[str] = None, + suffix_match: Optional[str] = None, + regex_match: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword header: Name of the header. + :paramtype header: str + :keyword exact_match: Exact value of the header. + :paramtype exact_match: str + :keyword prefix_match: Prefix value of the header. + :paramtype prefix_match: str + :keyword suffix_match: Suffix value of the header. + :paramtype suffix_match: str + :keyword regex_match: Regex value of the header. + :paramtype regex_match: str + """ + super().__init__(**kwargs) + self.header = header + self.exact_match = exact_match + self.prefix_match = prefix_match + self.suffix_match = suffix_match + self.regex_match = regex_match + + +class HttpConnectionPool(_serialization.Model): + """Defines parameters for http connection pooling. + + :ivar http1_max_pending_requests: Maximum number of pending http1 requests allowed. + :vartype http1_max_pending_requests: int + :ivar http2_max_requests: Maximum number of http2 requests allowed. + :vartype http2_max_requests: int + """ + + _attribute_map = { + "http1_max_pending_requests": {"key": "http1MaxPendingRequests", "type": "int"}, + "http2_max_requests": {"key": "http2MaxRequests", "type": "int"}, + } + + def __init__( + self, + *, + http1_max_pending_requests: Optional[int] = None, + http2_max_requests: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword http1_max_pending_requests: Maximum number of pending http1 requests allowed. + :paramtype http1_max_pending_requests: int + :keyword http2_max_requests: Maximum number of http2 requests allowed. + :paramtype http2_max_requests: int + """ + super().__init__(**kwargs) + self.http1_max_pending_requests = http1_max_pending_requests + self.http2_max_requests = http2_max_requests + + +class HttpGet(_serialization.Model): + """Model representing a http get request. + + All required parameters must be populated in order to send to 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 = { + "url": {"key": "url", "type": "str"}, + "file_name": {"key": "fileName", "type": "str"}, + "headers": {"key": "headers", "type": "[str]"}, + } + + def __init__( + self, *, url: str, file_name: Optional[str] = None, headers: Optional[List[str]] = None, **kwargs: Any + ) -> None: + """ + :keyword url: URL to make HTTP GET request against. Required. + :paramtype url: str + :keyword file_name: Name of the file that the request should be saved to. + :paramtype file_name: str + :keyword headers: List of headers to send with the request. + :paramtype headers: list[str] + """ + super().__init__(**kwargs) + self.url = url + self.file_name = file_name + self.headers = headers + + +class HttpRetryPolicy(_serialization.Model): + """Policy that defines http request retry conditions. + + :ivar max_retries: Maximum number of times a request will retry. + :vartype max_retries: int + :ivar headers: Headers that must be present for a request to be retried. + :vartype headers: list[~azure.mgmt.appcontainers.models.HeaderMatch] + :ivar http_status_codes: Additional http status codes that can trigger a retry. + :vartype http_status_codes: list[int] + :ivar errors: Errors that can trigger a retry. + :vartype errors: list[str] + :ivar initial_delay_in_milliseconds: Initial delay, in milliseconds, before retrying a request. + :vartype initial_delay_in_milliseconds: int + :ivar max_interval_in_milliseconds: Maximum interval, in milliseconds, between retries. + :vartype max_interval_in_milliseconds: int + """ + + _attribute_map = { + "max_retries": {"key": "maxRetries", "type": "int"}, + "headers": {"key": "matches.headers", "type": "[HeaderMatch]"}, + "http_status_codes": {"key": "matches.httpStatusCodes", "type": "[int]"}, + "errors": {"key": "matches.errors", "type": "[str]"}, + "initial_delay_in_milliseconds": {"key": "retryBackOff.initialDelayInMilliseconds", "type": "int"}, + "max_interval_in_milliseconds": {"key": "retryBackOff.maxIntervalInMilliseconds", "type": "int"}, + } + + def __init__( + self, + *, + max_retries: Optional[int] = None, + headers: Optional[List["_models.HeaderMatch"]] = None, + http_status_codes: Optional[List[int]] = None, + errors: Optional[List[str]] = None, + initial_delay_in_milliseconds: Optional[int] = None, + max_interval_in_milliseconds: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword max_retries: Maximum number of times a request will retry. + :paramtype max_retries: int + :keyword headers: Headers that must be present for a request to be retried. + :paramtype headers: list[~azure.mgmt.appcontainers.models.HeaderMatch] + :keyword http_status_codes: Additional http status codes that can trigger a retry. + :paramtype http_status_codes: list[int] + :keyword errors: Errors that can trigger a retry. + :paramtype errors: list[str] + :keyword initial_delay_in_milliseconds: Initial delay, in milliseconds, before retrying a + request. + :paramtype initial_delay_in_milliseconds: int + :keyword max_interval_in_milliseconds: Maximum interval, in milliseconds, between retries. + :paramtype max_interval_in_milliseconds: int + """ + super().__init__(**kwargs) + self.max_retries = max_retries + self.headers = headers + self.http_status_codes = http_status_codes + self.errors = errors + self.initial_delay_in_milliseconds = initial_delay_in_milliseconds + self.max_interval_in_milliseconds = max_interval_in_milliseconds + + +class HttpScaleRule(_serialization.Model): + """Container App container Http scaling rule. + + :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 = { + "metadata": {"key": "metadata", "type": "{str}"}, + "auth": {"key": "auth", "type": "[ScaleRuleAuth]"}, + "identity": {"key": "identity", "type": "str"}, } def __init__( @@ -4617,6 +6897,7 @@ def __init__( *, metadata: Optional[Dict[str, str]] = None, auth: Optional[List["_models.ScaleRuleAuth"]] = None, + identity: Optional[str] = None, **kwargs: Any ) -> None: """ @@ -4624,10 +6905,14 @@ def __init__( :paramtype metadata: dict[str, str] :keyword auth: Authentication secrets for the custom scale rule. :paramtype auth: list[~azure.mgmt.appcontainers.models.ScaleRuleAuth] + :keyword identity: The resource ID of a user-assigned managed identity that is assigned to the + Container App, or 'system' for system-assigned identity. + :paramtype identity: str """ super().__init__(**kwargs) self.metadata = metadata self.auth = auth + self.identity = identity class HttpSettings(_serialization.Model): @@ -4780,6 +7065,44 @@ def __init__( self.custom_open_id_connect_providers = custom_open_id_connect_providers +class IdentitySettings(_serialization.Model): + """Optional settings for a Managed Identity that is assigned to the Container App. + + All required parameters must be populated in order to send to server. + + :ivar identity: The resource ID of a user-assigned managed identity that is assigned to the + Container App, or 'system' for system-assigned identity. Required. + :vartype identity: str + :ivar lifecycle: Use to select the lifecycle stages of a Container App during which the Managed + Identity should be available. Known values are: "Init", "Main", "None", and "All". + :vartype lifecycle: str or ~azure.mgmt.appcontainers.models.IdentitySettingsLifeCycle + """ + + _validation = { + "identity": {"required": True}, + } + + _attribute_map = { + "identity": {"key": "identity", "type": "str"}, + "lifecycle": {"key": "lifecycle", "type": "str"}, + } + + def __init__( + self, *, identity: str, lifecycle: Union[str, "_models.IdentitySettingsLifeCycle"] = "All", **kwargs: Any + ) -> None: + """ + :keyword identity: The resource ID of a user-assigned managed identity that is assigned to the + Container App, or 'system' for system-assigned identity. Required. + :paramtype identity: str + :keyword lifecycle: Use to select the lifecycle stages of a Container App during which the + Managed Identity should be available. Known values are: "Init", "Main", "None", and "All". + :paramtype lifecycle: str or ~azure.mgmt.appcontainers.models.IdentitySettingsLifeCycle + """ + super().__init__(**kwargs) + self.identity = identity + self.lifecycle = lifecycle + + class Ingress(_serialization.Model): # pylint: disable=too-many-instance-attributes """Container App Ingress configuration. @@ -4818,6 +7141,10 @@ class Ingress(_serialization.Model): # pylint: disable=too-many-instance-attrib :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 = { @@ -4838,6 +7165,7 @@ class Ingress(_serialization.Model): # pylint: disable=too-many-instance-attrib "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__( @@ -4855,6 +7183,7 @@ def __init__( 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: """ @@ -4889,6 +7218,10 @@ def __init__( :paramtype cors_policy: ~azure.mgmt.appcontainers.models.CorsPolicy :keyword additional_port_mappings: Settings to expose additional ports on container app. :paramtype additional_port_mappings: list[~azure.mgmt.appcontainers.models.IngressPortMapping] + :keyword target_port_http_scheme: Whether an http app listens on http or https. Known values + are: "http" and "https". + :paramtype target_port_http_scheme: str or + ~azure.mgmt.appcontainers.models.IngressTargetPortHttpScheme """ super().__init__(**kwargs) self.fqdn = None @@ -4904,6 +7237,7 @@ def __init__( self.client_certificate_mode = client_certificate_mode self.cors_policy = cors_policy self.additional_port_mappings = additional_port_mappings + self.target_port_http_scheme = target_port_http_scheme class IngressPortMapping(_serialization.Model): @@ -4974,6 +7308,10 @@ class InitContainer(BaseContainer): :ivar image: Container image tag. :vartype image: str + :ivar image_type: The type of the image. Set to CloudBuild to let the system manages the image, + where user will not be able to update image through image field. Set to ContainerImage for user + provided image. Known values are: "CloudBuild" and "ContainerImage". + :vartype image_type: str or ~azure.mgmt.appcontainers.models.ImageType :ivar name: Custom container name. :vartype name: str :ivar command: Container start command. @@ -5047,15 +7385,13 @@ def __init__( self.action = action -class Job(TrackedResource): # pylint: disable=too-many-instance-attributes - """Container App Job. +class JavaComponent(ProxyResource): + """Java Component. Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to server. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -5065,28 +7401,8 @@ class Job(TrackedResource): # pylint: disable=too-many-instance-attributes :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData - :ivar 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 properties: Java Component resource specific properties. + :vartype properties: ~azure.mgmt.appcontainers.models.JavaComponentProperties """ _validation = { @@ -5094,10 +7410,6 @@ class Job(TrackedResource): # pylint: disable=too-many-instance-attributes "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 = { @@ -5105,1018 +7417,3016 @@ class Job(TrackedResource): # pylint: disable=too-many-instance-attributes "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"}, + "properties": {"key": "properties", "type": "JavaComponentProperties"}, } - 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, - **kwargs: Any - ) -> None: + def __init__(self, *, properties: Optional["_models.JavaComponentProperties"] = 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 properties: Java Component resource specific properties. + :paramtype properties: ~azure.mgmt.appcontainers.models.JavaComponentProperties """ - 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.properties = properties -class JobConfiguration(_serialization.Model): - """Non versioned Container Apps Job configuration properties. +class JavaComponentConfigurationProperty(_serialization.Model): + """Configuration properties for a Java Component. - All required parameters must be populated in order to send to server. + :ivar property_name: The name of the property. + :vartype property_name: str + :ivar value: The value of the property. + :vartype value: str + """ - :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] + _attribute_map = { + "property_name": {"key": "propertyName", "type": "str"}, + "value": {"key": "value", "type": "str"}, + } + + def __init__(self, *, property_name: Optional[str] = None, value: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword property_name: The name of the property. + :paramtype property_name: str + :keyword value: The value of the property. + :paramtype value: str + """ + super().__init__(**kwargs) + self.property_name = property_name + self.value = value + + +class JavaComponentIngress(_serialization.Model): + """Container App Ingress configuration. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar fqdn: Hostname of the Java Component endpoint. + :vartype fqdn: str """ _validation = { - "trigger_type": {"required": True}, - "replica_timeout": {"required": True}, + "fqdn": {"readonly": 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]"}, + "fqdn": {"key": "fqdn", "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, - **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] - """ + def __init__(self, **kwargs: Any) -> None: + """ """ 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.fqdn = None -class JobConfigurationEventTriggerConfig(_serialization.Model): - """Trigger configuration of an event driven job. +class JavaComponentProperties(_serialization.Model): + """Java Component common properties. - :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 + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + NacosComponent, SpringBootAdminComponent, SpringCloudConfigComponent, + SpringCloudEurekaComponent, SpringCloudGatewayComponent + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar component_type: Type of the Java Component. Required. Known values are: + "SpringBootAdmin", "SpringCloudEureka", "SpringCloudConfig", "SpringCloudGateway", and "Nacos". + :vartype component_type: str or ~azure.mgmt.appcontainers.models.JavaComponentType + :ivar provisioning_state: Provisioning state of the Java Component. Known values are: + "Succeeded", "Failed", "Canceled", "Deleting", and "InProgress". + :vartype provisioning_state: str or + ~azure.mgmt.appcontainers.models.JavaComponentProvisioningState + :ivar configurations: List of Java Components configuration properties. + :vartype configurations: + list[~azure.mgmt.appcontainers.models.JavaComponentConfigurationProperty] + :ivar scale: Java component scaling configurations. + :vartype scale: ~azure.mgmt.appcontainers.models.JavaComponentPropertiesScale + :ivar service_binds: List of Java Components that are bound to the Java component. + :vartype service_binds: list[~azure.mgmt.appcontainers.models.JavaComponentServiceBind] """ + _validation = { + "component_type": {"required": True}, + "provisioning_state": {"readonly": True}, + } + _attribute_map = { - "replica_completion_count": {"key": "replicaCompletionCount", "type": "int"}, - "parallelism": {"key": "parallelism", "type": "int"}, - "scale": {"key": "scale", "type": "JobScale"}, + "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, *, - replica_completion_count: Optional[int] = None, - parallelism: Optional[int] = None, - scale: Optional["_models.JobScale"] = None, + configurations: Optional[List["_models.JavaComponentConfigurationProperty"]] = None, + scale: Optional["_models.JavaComponentPropertiesScale"] = None, + service_binds: Optional[List["_models.JavaComponentServiceBind"]] = 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 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.replica_completion_count = replica_completion_count - self.parallelism = parallelism + self.component_type: Optional[str] = None + self.provisioning_state = None + self.configurations = configurations self.scale = scale + self.service_binds = service_binds -class JobConfigurationManualTriggerConfig(_serialization.Model): - """Manual trigger configuration for a single execution job. Properties replicaCompletionCount and - parallelism would be set to 1 by default. +class JavaComponentPropertiesScale(_serialization.Model): + """Java component scaling configurations. - :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 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 = { - "replica_completion_count": {"key": "replicaCompletionCount", "type": "int"}, - "parallelism": {"key": "parallelism", "type": "int"}, + "min_replicas": {"key": "minReplicas", "type": "int"}, + "max_replicas": {"key": "maxReplicas", "type": "int"}, } def __init__( - self, *, replica_completion_count: Optional[int] = None, parallelism: Optional[int] = None, **kwargs: Any + self, *, min_replicas: Optional[int] = None, max_replicas: Optional[int] = None, **kwargs: Any ) -> None: """ - :keyword replica_completion_count: Minimum number of successful replica completions before - overall job completion. - :paramtype replica_completion_count: int - :keyword parallelism: Number of parallel replicas of a job that can run at a given time. - :paramtype parallelism: int + :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.replica_completion_count = replica_completion_count - self.parallelism = parallelism + self.min_replicas = min_replicas + self.max_replicas = max_replicas -class JobConfigurationScheduleTriggerConfig(_serialization.Model): - """Cron formatted repeating trigger schedule ("\\ * * * * *") for cronjobs. Properties completions - and parallelism would be set to 1 by default. +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 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 value: Collection of resources. Required. + :vartype value: list[~azure.mgmt.appcontainers.models.JavaComponent] + :ivar next_link: Link to next page of resources. + :vartype next_link: str """ _validation = { - "cron_expression": {"required": True}, + "value": {"required": True}, + "next_link": {"readonly": True}, } _attribute_map = { - "replica_completion_count": {"key": "replicaCompletionCount", "type": "int"}, - "cron_expression": {"key": "cronExpression", "type": "str"}, - "parallelism": {"key": "parallelism", "type": "int"}, + "value": {"key": "value", "type": "[JavaComponent]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - cron_expression: str, - replica_completion_count: Optional[int] = None, - parallelism: Optional[int] = None, - **kwargs: Any - ) -> None: + def __init__(self, *, value: List["_models.JavaComponent"], **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 value: Collection of resources. Required. + :paramtype value: list[~azure.mgmt.appcontainers.models.JavaComponent] """ super().__init__(**kwargs) - self.replica_completion_count = replica_completion_count - self.cron_expression = cron_expression - self.parallelism = parallelism - + self.value = value + self.next_link = None -class JobExecution(_serialization.Model): - """Container Apps Job execution. - Variables are only populated by the server, and will be ignored when sending a request. +class JavaComponentServiceBind(_serialization.Model): + """Configuration to bind a Java Component to another Java Component. - :ivar name: Job execution Name. + :ivar name: Name of the service bind. :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 service_id: Resource id of the target service. + :vartype service_id: str """ - _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"}, + "service_id": {"key": "serviceId", "type": "str"}, } - 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, - **kwargs: Any - ) -> None: + def __init__(self, *, name: Optional[str] = None, service_id: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword name: Job execution Name. + :keyword name: Name of the service bind. :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 service_id: Resource id of the target service. + :paramtype service_id: str """ 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 - - -class JobExecutionBase(_serialization.Model): - """Container App's Job execution name. - - :ivar name: Job execution name. - :vartype name: str - :ivar id: Job execution Id. - :vartype id: str - """ + self.service_id = service_id - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "id": {"key": "id", "type": "str"}, - } - def __init__( - self, - *, - name: Optional[str] = None, - id: Optional[str] = None, # pylint: disable=redefined-builtin - **kwargs: Any - ) -> None: - """ - :keyword name: Job execution name. - :paramtype name: str - :keyword id: Job execution Id. - :paramtype id: str - """ - super().__init__(**kwargs) - self.name = name - self.id = id +class Job(TrackedResource): # pylint: disable=too-many-instance-attributes + """Container App Job. + Variables are only populated by the server, and will be ignored when sending a request. -class JobExecutionContainer(_serialization.Model): - """Container Apps Jobs execution container definition. + All required parameters must be populated in order to send to server. - :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 id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar extended_location: The complex type of the extended location. + :vartype extended_location: ~azure.mgmt.appcontainers.models.ExtendedLocation + :ivar identity: Managed identities needed by a container app job to interact with other Azure + services to not maintain any secrets or credentials in code. + :vartype identity: ~azure.mgmt.appcontainers.models.ManagedServiceIdentity + :ivar provisioning_state: Provisioning state of the Container Apps Job. Known values are: + "InProgress", "Succeeded", "Failed", "Canceled", and "Deleting". + :vartype provisioning_state: str or ~azure.mgmt.appcontainers.models.JobProvisioningState + :ivar running_state: Current running state of the job. Known values are: "Ready", + "Progressing", and "Suspended". + :vartype running_state: str or ~azure.mgmt.appcontainers.models.JobRunningState + :ivar environment_id: Resource ID of environment. + :vartype environment_id: str + :ivar workload_profile_name: Workload profile name to pin for container apps job execution. + :vartype workload_profile_name: str + :ivar configuration: Container Apps Job configuration properties. + :vartype configuration: ~azure.mgmt.appcontainers.models.JobConfiguration + :ivar template: Container Apps job definition. + :vartype template: ~azure.mgmt.appcontainers.models.JobTemplate + :ivar outbound_ip_addresses: Outbound IP Addresses of a container apps job. + :vartype outbound_ip_addresses: list[str] + :ivar event_stream_endpoint: The endpoint of the eventstream of the container apps job. + :vartype event_stream_endpoint: str """ + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, + "provisioning_state": {"readonly": True}, + "running_state": {"readonly": True}, + "outbound_ip_addresses": {"readonly": True}, + "event_stream_endpoint": {"readonly": True}, + } + _attribute_map = { - "image": {"key": "image", "type": "str"}, + "id": {"key": "id", "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"}, + "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, *, - 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, + location: str, + tags: Optional[Dict[str, str]] = None, + extended_location: Optional["_models.ExtendedLocation"] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, + environment_id: Optional[str] = None, + workload_profile_name: Optional[str] = None, + configuration: Optional["_models.JobConfiguration"] = None, + template: Optional["_models.JobTemplate"] = None, + **kwargs: Any + ) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str + :keyword extended_location: The complex type of the extended location. + :paramtype extended_location: ~azure.mgmt.appcontainers.models.ExtendedLocation + :keyword identity: Managed identities needed by a container app job to interact with other + Azure services to not maintain any secrets or credentials in code. + :paramtype identity: ~azure.mgmt.appcontainers.models.ManagedServiceIdentity + :keyword environment_id: Resource ID of environment. + :paramtype environment_id: str + :keyword workload_profile_name: Workload profile name to pin for container apps job execution. + :paramtype workload_profile_name: str + :keyword configuration: Container Apps Job configuration properties. + :paramtype configuration: ~azure.mgmt.appcontainers.models.JobConfiguration + :keyword template: Container Apps job definition. + :paramtype template: ~azure.mgmt.appcontainers.models.JobTemplate + """ + super().__init__(tags=tags, location=location, **kwargs) + self.extended_location = extended_location + self.identity = identity + self.provisioning_state = None + self.running_state = None + self.environment_id = environment_id + self.workload_profile_name = workload_profile_name + self.configuration = configuration + self.template = template + self.outbound_ip_addresses = None + self.event_stream_endpoint = None + + +class JobConfiguration(_serialization.Model): + """Non versioned Container Apps Job configuration properties. + + All required parameters must be populated in order to send to server. + + :ivar secrets: Collection of secrets used by a Container Apps Job. + :vartype secrets: list[~azure.mgmt.appcontainers.models.Secret] + :ivar trigger_type: Trigger type of the job. Known values are: "Schedule", "Event", and + "Manual". + :vartype trigger_type: str or ~azure.mgmt.appcontainers.models.TriggerType + :ivar replica_timeout: Maximum number of seconds a replica is allowed to run. Required. + :vartype replica_timeout: int + :ivar replica_retry_limit: Maximum number of retries before failing the job. + :vartype replica_retry_limit: int + :ivar manual_trigger_config: Manual trigger configuration for a single execution job. + Properties replicaCompletionCount and parallelism would be set to 1 by default. + :vartype manual_trigger_config: + ~azure.mgmt.appcontainers.models.JobConfigurationManualTriggerConfig + :ivar schedule_trigger_config: Cron formatted repeating trigger schedule ("\\ * * * * *") for + cronjobs. Properties completions and parallelism would be set to 1 by default. + :vartype schedule_trigger_config: + ~azure.mgmt.appcontainers.models.JobConfigurationScheduleTriggerConfig + :ivar event_trigger_config: Trigger configuration of an event driven job. + :vartype event_trigger_config: + ~azure.mgmt.appcontainers.models.JobConfigurationEventTriggerConfig + :ivar registries: Collection of private container registry credentials used by a Container apps + job. + :vartype registries: list[~azure.mgmt.appcontainers.models.RegistryCredentials] + :ivar identity_settings: Optional settings for Managed Identities that are assigned to the + Container App Job. If a Managed Identity is not specified here, default settings will be used. + :vartype identity_settings: list[~azure.mgmt.appcontainers.models.IdentitySettings] + """ + + _validation = { + "trigger_type": {"required": True}, + "replica_timeout": {"required": True}, + } + + _attribute_map = { + "secrets": {"key": "secrets", "type": "[Secret]"}, + "trigger_type": {"key": "triggerType", "type": "str"}, + "replica_timeout": {"key": "replicaTimeout", "type": "int"}, + "replica_retry_limit": {"key": "replicaRetryLimit", "type": "int"}, + "manual_trigger_config": {"key": "manualTriggerConfig", "type": "JobConfigurationManualTriggerConfig"}, + "schedule_trigger_config": {"key": "scheduleTriggerConfig", "type": "JobConfigurationScheduleTriggerConfig"}, + "event_trigger_config": {"key": "eventTriggerConfig", "type": "JobConfigurationEventTriggerConfig"}, + "registries": {"key": "registries", "type": "[RegistryCredentials]"}, + "identity_settings": {"key": "identitySettings", "type": "[IdentitySettings]"}, + } + + def __init__( + self, + *, + trigger_type: Union[str, "_models.TriggerType"] = "Manual", + replica_timeout: int, + secrets: Optional[List["_models.Secret"]] = None, + replica_retry_limit: Optional[int] = None, + manual_trigger_config: Optional["_models.JobConfigurationManualTriggerConfig"] = None, + schedule_trigger_config: Optional["_models.JobConfigurationScheduleTriggerConfig"] = None, + event_trigger_config: Optional["_models.JobConfigurationEventTriggerConfig"] = None, + registries: Optional[List["_models.RegistryCredentials"]] = None, + identity_settings: Optional[List["_models.IdentitySettings"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword secrets: Collection of secrets used by a Container Apps Job. + :paramtype secrets: list[~azure.mgmt.appcontainers.models.Secret] + :keyword trigger_type: Trigger type of the job. Known values are: "Schedule", "Event", and + "Manual". + :paramtype trigger_type: str or ~azure.mgmt.appcontainers.models.TriggerType + :keyword replica_timeout: Maximum number of seconds a replica is allowed to run. Required. + :paramtype replica_timeout: int + :keyword replica_retry_limit: Maximum number of retries before failing the job. + :paramtype replica_retry_limit: int + :keyword manual_trigger_config: Manual trigger configuration for a single execution job. + Properties replicaCompletionCount and parallelism would be set to 1 by default. + :paramtype manual_trigger_config: + ~azure.mgmt.appcontainers.models.JobConfigurationManualTriggerConfig + :keyword schedule_trigger_config: Cron formatted repeating trigger schedule ("\\ * * * * *") + for cronjobs. Properties completions and parallelism would be set to 1 by default. + :paramtype schedule_trigger_config: + ~azure.mgmt.appcontainers.models.JobConfigurationScheduleTriggerConfig + :keyword event_trigger_config: Trigger configuration of an event driven job. + :paramtype event_trigger_config: + ~azure.mgmt.appcontainers.models.JobConfigurationEventTriggerConfig + :keyword registries: Collection of private container registry credentials used by a Container + apps job. + :paramtype registries: list[~azure.mgmt.appcontainers.models.RegistryCredentials] + :keyword identity_settings: Optional settings for Managed Identities that are assigned to the + Container App Job. If a Managed Identity is not specified here, default settings will be used. + :paramtype identity_settings: list[~azure.mgmt.appcontainers.models.IdentitySettings] + """ + super().__init__(**kwargs) + self.secrets = secrets + self.trigger_type = trigger_type + self.replica_timeout = replica_timeout + self.replica_retry_limit = replica_retry_limit + self.manual_trigger_config = manual_trigger_config + self.schedule_trigger_config = schedule_trigger_config + self.event_trigger_config = event_trigger_config + self.registries = registries + self.identity_settings = identity_settings + + +class JobConfigurationEventTriggerConfig(_serialization.Model): + """Trigger configuration of an event driven job. + + :ivar replica_completion_count: Minimum number of successful replica completions before overall + job completion. + :vartype replica_completion_count: int + :ivar parallelism: Number of parallel replicas of a job that can run at a given time. + :vartype parallelism: int + :ivar scale: Scaling configurations for event driven jobs. + :vartype scale: ~azure.mgmt.appcontainers.models.JobScale + """ + + _attribute_map = { + "replica_completion_count": {"key": "replicaCompletionCount", "type": "int"}, + "parallelism": {"key": "parallelism", "type": "int"}, + "scale": {"key": "scale", "type": "JobScale"}, + } + + def __init__( + self, + *, + replica_completion_count: Optional[int] = None, + parallelism: Optional[int] = None, + scale: Optional["_models.JobScale"] = None, + **kwargs: Any + ) -> None: + """ + :keyword replica_completion_count: Minimum number of successful replica completions before + overall job completion. + :paramtype replica_completion_count: int + :keyword parallelism: Number of parallel replicas of a job that can run at a given time. + :paramtype parallelism: int + :keyword scale: Scaling configurations for event driven jobs. + :paramtype scale: ~azure.mgmt.appcontainers.models.JobScale + """ + super().__init__(**kwargs) + self.replica_completion_count = replica_completion_count + self.parallelism = parallelism + self.scale = scale + + +class JobConfigurationManualTriggerConfig(_serialization.Model): + """Manual trigger configuration for a single execution job. Properties replicaCompletionCount and + parallelism would be set to 1 by default. + + :ivar replica_completion_count: Minimum number of successful replica completions before overall + job completion. + :vartype replica_completion_count: int + :ivar parallelism: Number of parallel replicas of a job that can run at a given time. + :vartype parallelism: int + """ + + _attribute_map = { + "replica_completion_count": {"key": "replicaCompletionCount", "type": "int"}, + "parallelism": {"key": "parallelism", "type": "int"}, + } + + def __init__( + self, *, replica_completion_count: Optional[int] = None, parallelism: Optional[int] = None, **kwargs: Any + ) -> None: + """ + :keyword replica_completion_count: Minimum number of successful replica completions before + overall job completion. + :paramtype replica_completion_count: int + :keyword parallelism: Number of parallel replicas of a job that can run at a given time. + :paramtype parallelism: int + """ + super().__init__(**kwargs) + self.replica_completion_count = replica_completion_count + self.parallelism = parallelism + + +class JobConfigurationScheduleTriggerConfig(_serialization.Model): + """Cron formatted repeating trigger schedule ("\\ * * * * *") for cronjobs. Properties completions + and parallelism would be set to 1 by default. + + All required parameters must be populated in order to send to server. + + :ivar replica_completion_count: Minimum number of successful replica completions before overall + job completion. + :vartype replica_completion_count: int + :ivar cron_expression: Cron formatted repeating schedule ("\\ * * * * *") of a Cron Job. + Required. + :vartype cron_expression: str + :ivar parallelism: Number of parallel replicas of a job that can run at a given time. + :vartype parallelism: int + """ + + _validation = { + "cron_expression": {"required": True}, + } + + _attribute_map = { + "replica_completion_count": {"key": "replicaCompletionCount", "type": "int"}, + "cron_expression": {"key": "cronExpression", "type": "str"}, + "parallelism": {"key": "parallelism", "type": "int"}, + } + + def __init__( + self, + *, + cron_expression: str, + replica_completion_count: Optional[int] = None, + parallelism: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword replica_completion_count: Minimum number of successful replica completions before + overall job completion. + :paramtype replica_completion_count: int + :keyword cron_expression: Cron formatted repeating schedule ("\\ * * * * *") of a Cron Job. + Required. + :paramtype cron_expression: str + :keyword parallelism: Number of parallel replicas of a job that can run at a given time. + :paramtype parallelism: int + """ + super().__init__(**kwargs) + self.replica_completion_count = replica_completion_count + self.cron_expression = cron_expression + self.parallelism = parallelism + + +class JobExecution(_serialization.Model): + """Container Apps Job execution. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Job execution Name. + :vartype name: str + :ivar id: Job execution Id. + :vartype id: str + :ivar type: Job execution type. + :vartype type: str + :ivar status: Current running State of the job. Known values are: "Running", "Processing", + "Stopped", "Degraded", "Failed", "Unknown", and "Succeeded". + :vartype status: str or ~azure.mgmt.appcontainers.models.JobExecutionRunningState + :ivar start_time: Job execution start time. + :vartype start_time: ~datetime.datetime + :ivar end_time: Job execution end time. + :vartype end_time: ~datetime.datetime + :ivar template: Job's execution container. + :vartype template: ~azure.mgmt.appcontainers.models.JobExecutionTemplate + :ivar detailed_status: Detailed status of the job execution. + :vartype detailed_status: ~azure.mgmt.appcontainers.models.ExecutionStatus + """ + + _validation = { + "status": {"readonly": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "id": {"key": "id", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "status": {"key": "properties.status", "type": "str"}, + "start_time": {"key": "properties.startTime", "type": "iso-8601"}, + "end_time": {"key": "properties.endTime", "type": "iso-8601"}, + "template": {"key": "properties.template", "type": "JobExecutionTemplate"}, + "detailed_status": {"key": "properties.detailedStatus", "type": "ExecutionStatus"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin + type: Optional[str] = None, + start_time: Optional[datetime.datetime] = None, + end_time: Optional[datetime.datetime] = None, + template: Optional["_models.JobExecutionTemplate"] = None, + detailed_status: Optional["_models.ExecutionStatus"] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: Job execution Name. + :paramtype name: str + :keyword id: Job execution Id. + :paramtype id: str + :keyword type: Job execution type. + :paramtype type: str + :keyword start_time: Job execution start time. + :paramtype start_time: ~datetime.datetime + :keyword end_time: Job execution end time. + :paramtype end_time: ~datetime.datetime + :keyword template: Job's execution container. + :paramtype template: ~azure.mgmt.appcontainers.models.JobExecutionTemplate + :keyword detailed_status: Detailed status of the job execution. + :paramtype detailed_status: ~azure.mgmt.appcontainers.models.ExecutionStatus + """ + super().__init__(**kwargs) + self.name = name + self.id = id + self.type = type + self.status = None + self.start_time = start_time + self.end_time = end_time + self.template = template + self.detailed_status = detailed_status + + +class JobExecutionBase(_serialization.Model): + """Container App's Job execution name. + + :ivar name: Job execution name. + :vartype name: str + :ivar id: Job execution Id. + :vartype id: str + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "id": {"key": "id", "type": "str"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin + **kwargs: Any + ) -> None: + """ + :keyword name: Job execution name. + :paramtype name: str + :keyword id: Job execution Id. + :paramtype id: str + """ + super().__init__(**kwargs) + self.name = name + self.id = id + + +class JobExecutionContainer(_serialization.Model): + """Container Apps Jobs execution container definition. + + :ivar image: Container image tag. + :vartype image: str + :ivar name: Custom container name. + :vartype name: str + :ivar command: Container start command. + :vartype command: list[str] + :ivar args: Container start command arguments. + :vartype args: list[str] + :ivar env: Container environment variables. + :vartype env: list[~azure.mgmt.appcontainers.models.EnvironmentVar] + :ivar resources: Container resource requirements. + :vartype resources: ~azure.mgmt.appcontainers.models.ContainerResources + """ + + _attribute_map = { + "image": {"key": "image", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "command": {"key": "command", "type": "[str]"}, + "args": {"key": "args", "type": "[str]"}, + "env": {"key": "env", "type": "[EnvironmentVar]"}, + "resources": {"key": "resources", "type": "ContainerResources"}, + } + + def __init__( + self, + *, + image: Optional[str] = None, + name: Optional[str] = None, + command: Optional[List[str]] = None, + args: Optional[List[str]] = None, + env: Optional[List["_models.EnvironmentVar"]] = None, + resources: Optional["_models.ContainerResources"] = None, + **kwargs: Any + ) -> None: + """ + :keyword image: Container image tag. + :paramtype image: str + :keyword name: Custom container name. + :paramtype name: str + :keyword command: Container start command. + :paramtype command: list[str] + :keyword args: Container start command arguments. + :paramtype args: list[str] + :keyword env: Container environment variables. + :paramtype env: list[~azure.mgmt.appcontainers.models.EnvironmentVar] + :keyword resources: Container resource requirements. + :paramtype resources: ~azure.mgmt.appcontainers.models.ContainerResources + """ + super().__init__(**kwargs) + self.image = image + self.name = name + self.command = command + self.args = args + self.env = env + self.resources = resources + + +class JobExecutionNamesCollection(_serialization.Model): + """Container App executions names list. + + All required parameters must be populated in order to send to server. + + :ivar value: Collection of resources. Required. + :vartype value: list[~azure.mgmt.appcontainers.models.JobExecutionBase] + """ + + _validation = { + "value": {"required": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[JobExecutionBase]"}, + } + + def __init__(self, *, value: List["_models.JobExecutionBase"], **kwargs: Any) -> None: + """ + :keyword value: Collection of resources. Required. + :paramtype value: list[~azure.mgmt.appcontainers.models.JobExecutionBase] + """ + super().__init__(**kwargs) + self.value = value + + +class JobExecutionTemplate(_serialization.Model): + """Job's execution template, containing container configuration for a job's execution. + + :ivar containers: List of container definitions for the Container Apps Job. + :vartype containers: list[~azure.mgmt.appcontainers.models.JobExecutionContainer] + :ivar init_containers: List of specialized containers that run before job containers. + :vartype init_containers: list[~azure.mgmt.appcontainers.models.JobExecutionContainer] + """ + + _attribute_map = { + "containers": {"key": "containers", "type": "[JobExecutionContainer]"}, + "init_containers": {"key": "initContainers", "type": "[JobExecutionContainer]"}, + } + + def __init__( + self, + *, + containers: Optional[List["_models.JobExecutionContainer"]] = None, + init_containers: Optional[List["_models.JobExecutionContainer"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword containers: List of container definitions for the Container Apps Job. + :paramtype containers: list[~azure.mgmt.appcontainers.models.JobExecutionContainer] + :keyword init_containers: List of specialized containers that run before job containers. + :paramtype init_containers: list[~azure.mgmt.appcontainers.models.JobExecutionContainer] + """ + super().__init__(**kwargs) + self.containers = containers + self.init_containers = init_containers + + +class JobPatchProperties(_serialization.Model): + """Container Apps Job resource specific properties. + + :ivar extended_location: The complex type of the extended location. + :vartype extended_location: ~azure.mgmt.appcontainers.models.ExtendedLocation + :ivar identity: Managed identities needed by a container app job to interact with other Azure + services to not maintain any secrets or credentials in code. + :vartype identity: ~azure.mgmt.appcontainers.models.ManagedServiceIdentity + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar properties: + :vartype properties: ~azure.mgmt.appcontainers.models.JobPatchPropertiesProperties + """ + + _attribute_map = { + "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, + "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, + "tags": {"key": "tags", "type": "{str}"}, + "properties": {"key": "properties", "type": "JobPatchPropertiesProperties"}, + } + + def __init__( + self, + *, + extended_location: Optional["_models.ExtendedLocation"] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, + tags: Optional[Dict[str, str]] = None, + properties: Optional["_models.JobPatchPropertiesProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword extended_location: The complex type of the extended location. + :paramtype extended_location: ~azure.mgmt.appcontainers.models.ExtendedLocation + :keyword identity: Managed identities needed by a container app job to interact with other + Azure services to not maintain any secrets or credentials in code. + :paramtype identity: ~azure.mgmt.appcontainers.models.ManagedServiceIdentity + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword properties: + :paramtype properties: ~azure.mgmt.appcontainers.models.JobPatchPropertiesProperties + """ + super().__init__(**kwargs) + self.extended_location = extended_location + self.identity = identity + self.tags = tags + self.properties = properties + + +class JobPatchPropertiesProperties(_serialization.Model): + """JobPatchPropertiesProperties. + + :ivar environment_id: Resource ID of environment. + :vartype environment_id: str + :ivar configuration: Container Apps Job configuration properties. + :vartype configuration: ~azure.mgmt.appcontainers.models.JobConfiguration + :ivar template: Container Apps job definition. + :vartype template: ~azure.mgmt.appcontainers.models.JobTemplate + :ivar outbound_ip_addresses: Outbound IP Addresses of a container apps job. + :vartype outbound_ip_addresses: list[str] + :ivar event_stream_endpoint: The endpoint of the eventstream of the container apps job. + :vartype event_stream_endpoint: str + """ + + _attribute_map = { + "environment_id": {"key": "environmentId", "type": "str"}, + "configuration": {"key": "configuration", "type": "JobConfiguration"}, + "template": {"key": "template", "type": "JobTemplate"}, + "outbound_ip_addresses": {"key": "outboundIpAddresses", "type": "[str]"}, + "event_stream_endpoint": {"key": "eventStreamEndpoint", "type": "str"}, + } + + def __init__( + self, + *, + environment_id: Optional[str] = None, + configuration: Optional["_models.JobConfiguration"] = None, + template: Optional["_models.JobTemplate"] = None, + outbound_ip_addresses: Optional[List[str]] = None, + event_stream_endpoint: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword environment_id: Resource ID of environment. + :paramtype environment_id: str + :keyword configuration: Container Apps Job configuration properties. + :paramtype configuration: ~azure.mgmt.appcontainers.models.JobConfiguration + :keyword template: Container Apps job definition. + :paramtype template: ~azure.mgmt.appcontainers.models.JobTemplate + :keyword outbound_ip_addresses: Outbound IP Addresses of a container apps job. + :paramtype outbound_ip_addresses: list[str] + :keyword event_stream_endpoint: The endpoint of the eventstream of the container apps job. + :paramtype event_stream_endpoint: str + """ + super().__init__(**kwargs) + self.environment_id = environment_id + self.configuration = configuration + self.template = template + self.outbound_ip_addresses = outbound_ip_addresses + self.event_stream_endpoint = event_stream_endpoint + + +class JobScale(_serialization.Model): + """Scaling configurations for event driven jobs. + + :ivar polling_interval: Interval to check each event source in seconds. Defaults to 30s. + :vartype polling_interval: int + :ivar min_executions: Minimum number of job executions that are created for a trigger, default + 0. + :vartype min_executions: int + :ivar max_executions: Maximum number of job executions that are created for a trigger, default + 100. + :vartype max_executions: int + :ivar rules: Scaling rules. + :vartype rules: list[~azure.mgmt.appcontainers.models.JobScaleRule] + """ + + _attribute_map = { + "polling_interval": {"key": "pollingInterval", "type": "int"}, + "min_executions": {"key": "minExecutions", "type": "int"}, + "max_executions": {"key": "maxExecutions", "type": "int"}, + "rules": {"key": "rules", "type": "[JobScaleRule]"}, + } + + def __init__( + self, + *, + polling_interval: Optional[int] = None, + min_executions: int = 0, + max_executions: int = 100, + rules: Optional[List["_models.JobScaleRule"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword polling_interval: Interval to check each event source in seconds. Defaults to 30s. + :paramtype polling_interval: int + :keyword min_executions: Minimum number of job executions that are created for a trigger, + default 0. + :paramtype min_executions: int + :keyword max_executions: Maximum number of job executions that are created for a trigger, + default 100. + :paramtype max_executions: int + :keyword rules: Scaling rules. + :paramtype rules: list[~azure.mgmt.appcontainers.models.JobScaleRule] + """ + super().__init__(**kwargs) + self.polling_interval = polling_interval + self.min_executions = min_executions + self.max_executions = max_executions + self.rules = rules + + +class JobScaleRule(_serialization.Model): + """Scaling rule. + + :ivar name: Scale Rule Name. + :vartype name: str + :ivar type: Type of the scale rule + eg: azure-servicebus, redis etc. + :vartype type: str + :ivar metadata: Metadata properties to describe the scale rule. + :vartype metadata: JSON + :ivar auth: Authentication secrets for the scale rule. + :vartype auth: list[~azure.mgmt.appcontainers.models.ScaleRuleAuth] + :ivar identity: The resource ID of a user-assigned managed identity that is assigned to the + job, or 'system' for system-assigned identity. + :vartype identity: str + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "metadata": {"key": "metadata", "type": "object"}, + "auth": {"key": "auth", "type": "[ScaleRuleAuth]"}, + "identity": {"key": "identity", "type": "str"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + type: Optional[str] = None, + metadata: Optional[JSON] = None, + auth: Optional[List["_models.ScaleRuleAuth"]] = None, + identity: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: Scale Rule Name. + :paramtype name: str + :keyword type: Type of the scale rule + eg: azure-servicebus, redis etc. + :paramtype type: str + :keyword metadata: Metadata properties to describe the scale rule. + :paramtype metadata: JSON + :keyword auth: Authentication secrets for the scale rule. + :paramtype auth: list[~azure.mgmt.appcontainers.models.ScaleRuleAuth] + :keyword identity: The resource ID of a user-assigned managed identity that is assigned to the + job, or 'system' for system-assigned identity. + :paramtype identity: str + """ + super().__init__(**kwargs) + self.name = name + self.type = type + self.metadata = metadata + self.auth = auth + self.identity = identity + + +class JobsCollection(_serialization.Model): + """Container Apps Jobs collection ARM resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar value: Collection of resources. Required. + :vartype value: list[~azure.mgmt.appcontainers.models.Job] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[Job]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.Job"], **kwargs: Any) -> None: + """ + :keyword value: Collection of resources. Required. + :paramtype value: list[~azure.mgmt.appcontainers.models.Job] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class JobSecretsCollection(_serialization.Model): + """Container Apps Job Secrets Collection ARM resource. + + All required parameters must be populated in order to send to server. + + :ivar value: Collection of resources. Required. + :vartype value: list[~azure.mgmt.appcontainers.models.Secret] + """ + + _validation = { + "value": {"required": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[Secret]"}, + } + + def __init__(self, *, value: List["_models.Secret"], **kwargs: Any) -> None: + """ + :keyword value: Collection of resources. Required. + :paramtype value: list[~azure.mgmt.appcontainers.models.Secret] + """ + super().__init__(**kwargs) + self.value = value + + +class JobTemplate(_serialization.Model): + """Container Apps Job versioned application definition. Defines the desired state of an immutable + revision. Any changes to this section Will result in a new revision being created. + + :ivar init_containers: List of specialized containers that run before app containers. + :vartype init_containers: list[~azure.mgmt.appcontainers.models.InitContainer] + :ivar containers: List of container definitions for the Container App. + :vartype containers: list[~azure.mgmt.appcontainers.models.Container] + :ivar volumes: List of volume definitions for the Container App. + :vartype volumes: list[~azure.mgmt.appcontainers.models.Volume] + """ + + _attribute_map = { + "init_containers": {"key": "initContainers", "type": "[InitContainer]"}, + "containers": {"key": "containers", "type": "[Container]"}, + "volumes": {"key": "volumes", "type": "[Volume]"}, + } + + def __init__( + self, + *, + init_containers: Optional[List["_models.InitContainer"]] = None, + containers: Optional[List["_models.Container"]] = None, + volumes: Optional[List["_models.Volume"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword init_containers: List of specialized containers that run before app containers. + :paramtype init_containers: list[~azure.mgmt.appcontainers.models.InitContainer] + :keyword containers: List of container definitions for the Container App. + :paramtype containers: list[~azure.mgmt.appcontainers.models.Container] + :keyword volumes: List of volume definitions for the Container App. + :paramtype volumes: list[~azure.mgmt.appcontainers.models.Volume] + """ + super().__init__(**kwargs) + self.init_containers = init_containers + self.containers = containers + self.volumes = volumes + + +class JwtClaimChecks(_serialization.Model): + """The configuration settings of the checks that should be made while validating the JWT Claims. + + :ivar allowed_groups: The list of the allowed groups. + :vartype allowed_groups: list[str] + :ivar allowed_client_applications: The list of the allowed client applications. + :vartype allowed_client_applications: list[str] + """ + + _attribute_map = { + "allowed_groups": {"key": "allowedGroups", "type": "[str]"}, + "allowed_client_applications": {"key": "allowedClientApplications", "type": "[str]"}, + } + + def __init__( + self, + *, + allowed_groups: Optional[List[str]] = None, + allowed_client_applications: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword allowed_groups: The list of the allowed groups. + :paramtype allowed_groups: list[str] + :keyword allowed_client_applications: The list of the allowed client applications. + :paramtype allowed_client_applications: list[str] + """ + super().__init__(**kwargs) + self.allowed_groups = allowed_groups + self.allowed_client_applications = allowed_client_applications + + +class KedaConfiguration(_serialization.Model): + """Configuration properties Keda component. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar version: The version of Keda. + :vartype version: str + """ + + _validation = { + "version": {"readonly": True}, + } + + _attribute_map = { + "version": {"key": "version", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.version = None + + +class ListUsagesResult(_serialization.Model): + """ListUsagesResult. + + :ivar value: The list of compute resource usages. + :vartype value: list[~azure.mgmt.appcontainers.models.Usage] + :ivar next_link: The URI to fetch the next page of compute resource usage information. Call + ListNext() with this to fetch the next page of compute resource usage information. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[Usage]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.Usage"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The list of compute resource usages. + :paramtype value: list[~azure.mgmt.appcontainers.models.Usage] + :keyword next_link: The URI to fetch the next page of compute resource usage information. Call + ListNext() with this to fetch the next page of compute resource usage information. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class LogAnalyticsConfiguration(_serialization.Model): + """Log Analytics configuration, must only be provided when destination is configured as + 'log-analytics'. + + :ivar customer_id: Log analytics customer id. + :vartype customer_id: str + :ivar shared_key: Log analytics customer key. + :vartype shared_key: str + :ivar dynamic_json_columns: Boolean indicating whether to parse json string log into dynamic + json columns. + :vartype dynamic_json_columns: bool + """ + + _attribute_map = { + "customer_id": {"key": "customerId", "type": "str"}, + "shared_key": {"key": "sharedKey", "type": "str"}, + "dynamic_json_columns": {"key": "dynamicJsonColumns", "type": "bool"}, + } + + def __init__( + self, + *, + customer_id: Optional[str] = None, + shared_key: Optional[str] = None, + dynamic_json_columns: Optional[bool] = None, + **kwargs: Any + ) -> None: + """ + :keyword customer_id: Log analytics customer id. + :paramtype customer_id: str + :keyword shared_key: Log analytics customer key. + :paramtype shared_key: str + :keyword dynamic_json_columns: Boolean indicating whether to parse json string log into dynamic + json columns. + :paramtype dynamic_json_columns: bool + """ + super().__init__(**kwargs) + self.customer_id = customer_id + self.shared_key = shared_key + self.dynamic_json_columns = dynamic_json_columns + + +class LoggerSetting(_serialization.Model): + """Logger settings for java workloads. + + All required parameters must be populated in order to send to server. + + :ivar logger: Logger name. Required. + :vartype logger: str + :ivar level: The specified logger's log level. Required. Known values are: "off", "error", + "info", "debug", "trace", and "warn". + :vartype level: str or ~azure.mgmt.appcontainers.models.Level + """ + + _validation = { + "logger": {"required": True}, + "level": {"required": True}, + } + + _attribute_map = { + "logger": {"key": "logger", "type": "str"}, + "level": {"key": "level", "type": "str"}, + } + + def __init__(self, *, logger: str, level: Union[str, "_models.Level"], **kwargs: Any) -> None: + """ + :keyword logger: Logger name. Required. + :paramtype logger: str + :keyword level: The specified logger's log level. Required. Known values are: "off", "error", + "info", "debug", "trace", and "warn". + :paramtype level: str or ~azure.mgmt.appcontainers.models.Level + """ + super().__init__(**kwargs) + self.logger = logger + self.level = level + + +class LogicApp(ProxyResource): + """A logic app extension resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData + :ivar properties: The resource-specific properties for this resource. + :vartype properties: JSON + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "properties": {"key": "properties", "type": "object"}, + } + + def __init__(self, *, properties: Optional[JSON] = None, **kwargs: Any) -> None: + """ + :keyword properties: The resource-specific properties for this resource. + :paramtype properties: JSON + """ + super().__init__(**kwargs) + self.properties = properties + + +class Login(_serialization.Model): + """The configuration settings of the login flow of users using ContainerApp Service + Authentication/Authorization. + + :ivar routes: The routes that specify the endpoints used for login and logout requests. + :vartype routes: ~azure.mgmt.appcontainers.models.LoginRoutes + :ivar token_store: The configuration settings of the token store. + :vartype token_store: ~azure.mgmt.appcontainers.models.TokenStore + :ivar preserve_url_fragments_for_logins: :code:`true` if the fragments from the + request are preserved after the login request is made; otherwise, :code:`false`. + :vartype preserve_url_fragments_for_logins: bool + :ivar allowed_external_redirect_urls: External URLs that can be redirected to as part of + logging in or logging out of the app. Note that the query string part of the URL is ignored. + This is an advanced setting typically only needed by Windows Store application backends. + Note that URLs within the current domain are always implicitly allowed. + :vartype allowed_external_redirect_urls: list[str] + :ivar cookie_expiration: The configuration settings of the session cookie's expiration. + :vartype cookie_expiration: ~azure.mgmt.appcontainers.models.CookieExpiration + :ivar nonce: The configuration settings of the nonce used in the login flow. + :vartype nonce: ~azure.mgmt.appcontainers.models.Nonce + """ + + _attribute_map = { + "routes": {"key": "routes", "type": "LoginRoutes"}, + "token_store": {"key": "tokenStore", "type": "TokenStore"}, + "preserve_url_fragments_for_logins": {"key": "preserveUrlFragmentsForLogins", "type": "bool"}, + "allowed_external_redirect_urls": {"key": "allowedExternalRedirectUrls", "type": "[str]"}, + "cookie_expiration": {"key": "cookieExpiration", "type": "CookieExpiration"}, + "nonce": {"key": "nonce", "type": "Nonce"}, + } + + def __init__( + self, + *, + routes: Optional["_models.LoginRoutes"] = None, + token_store: Optional["_models.TokenStore"] = None, + preserve_url_fragments_for_logins: Optional[bool] = None, + allowed_external_redirect_urls: Optional[List[str]] = None, + cookie_expiration: Optional["_models.CookieExpiration"] = None, + nonce: Optional["_models.Nonce"] = None, + **kwargs: Any + ) -> None: + """ + :keyword routes: The routes that specify the endpoints used for login and logout requests. + :paramtype routes: ~azure.mgmt.appcontainers.models.LoginRoutes + :keyword token_store: The configuration settings of the token store. + :paramtype token_store: ~azure.mgmt.appcontainers.models.TokenStore + :keyword preserve_url_fragments_for_logins: :code:`true` if the fragments from the + request are preserved after the login request is made; otherwise, :code:`false`. + :paramtype preserve_url_fragments_for_logins: bool + :keyword allowed_external_redirect_urls: External URLs that can be redirected to as part of + logging in or logging out of the app. Note that the query string part of the URL is ignored. + This is an advanced setting typically only needed by Windows Store application backends. + Note that URLs within the current domain are always implicitly allowed. + :paramtype allowed_external_redirect_urls: list[str] + :keyword cookie_expiration: The configuration settings of the session cookie's expiration. + :paramtype cookie_expiration: ~azure.mgmt.appcontainers.models.CookieExpiration + :keyword nonce: The configuration settings of the nonce used in the login flow. + :paramtype nonce: ~azure.mgmt.appcontainers.models.Nonce + """ + super().__init__(**kwargs) + self.routes = routes + self.token_store = token_store + self.preserve_url_fragments_for_logins = preserve_url_fragments_for_logins + self.allowed_external_redirect_urls = allowed_external_redirect_urls + self.cookie_expiration = cookie_expiration + self.nonce = nonce + + +class LoginRoutes(_serialization.Model): + """The routes that specify the endpoints used for login and logout requests. + + :ivar logout_endpoint: The endpoint at which a logout request should be made. + :vartype logout_endpoint: str + """ + + _attribute_map = { + "logout_endpoint": {"key": "logoutEndpoint", "type": "str"}, + } + + def __init__(self, *, logout_endpoint: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword logout_endpoint: The endpoint at which a logout request should be made. + :paramtype logout_endpoint: str + """ + super().__init__(**kwargs) + self.logout_endpoint = logout_endpoint + + +class LoginScopes(_serialization.Model): + """The configuration settings of the login flow, including the scopes that should be requested. + + :ivar scopes: A list of the scopes that should be requested while authenticating. + :vartype scopes: list[str] + """ + + _attribute_map = { + "scopes": {"key": "scopes", "type": "[str]"}, + } + + def __init__(self, *, scopes: Optional[List[str]] = None, **kwargs: Any) -> None: + """ + :keyword scopes: A list of the scopes that should be requested while authenticating. + :paramtype scopes: list[str] + """ + super().__init__(**kwargs) + self.scopes = scopes + + +class LogsConfiguration(_serialization.Model): + """Configuration of Open Telemetry logs. + + :ivar destinations: Open telemetry logs destinations. + :vartype destinations: list[str] + """ + + _attribute_map = { + "destinations": {"key": "destinations", "type": "[str]"}, + } + + def __init__(self, *, destinations: Optional[List[str]] = None, **kwargs: Any) -> None: + """ + :keyword destinations: Open telemetry logs destinations. + :paramtype destinations: list[str] + """ + super().__init__(**kwargs) + self.destinations = destinations + + +class ManagedCertificate(TrackedResource): + """Managed certificates used for Custom Domain bindings of Container Apps in a Managed + Environment. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar properties: Certificate resource specific properties. + :vartype properties: ~azure.mgmt.appcontainers.models.ManagedCertificateProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "properties": {"key": "properties", "type": "ManagedCertificateProperties"}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + properties: Optional["_models.ManagedCertificateProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str + :keyword properties: Certificate resource specific properties. + :paramtype properties: ~azure.mgmt.appcontainers.models.ManagedCertificateProperties + """ + super().__init__(tags=tags, location=location, **kwargs) + self.properties = properties + + +class ManagedCertificateCollection(_serialization.Model): + """Collection of Managed Certificates. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar value: Collection of resources. Required. + :vartype value: list[~azure.mgmt.appcontainers.models.ManagedCertificate] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[ManagedCertificate]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.ManagedCertificate"], **kwargs: Any) -> None: + """ + :keyword value: Collection of resources. Required. + :paramtype value: list[~azure.mgmt.appcontainers.models.ManagedCertificate] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class ManagedCertificatePatch(_serialization.Model): + """A managed certificate to update. + + :ivar tags: Application-specific metadata in the form of key-value pairs. + :vartype tags: dict[str, str] + """ + + _attribute_map = { + "tags": {"key": "tags", "type": "{str}"}, + } + + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: + """ + :keyword tags: Application-specific metadata in the form of key-value pairs. + :paramtype tags: dict[str, str] + """ + super().__init__(**kwargs) + self.tags = tags + + +class ManagedCertificateProperties(_serialization.Model): + """Certificate resource specific properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: Provisioning state of the certificate. Known values are: "Succeeded", + "Failed", "Canceled", "DeleteFailed", and "Pending". + :vartype provisioning_state: str or + ~azure.mgmt.appcontainers.models.CertificateProvisioningState + :ivar subject_name: Subject name of the certificate. + :vartype subject_name: str + :ivar error: Any error occurred during the certificate provision. + :vartype error: str + :ivar domain_control_validation: Selected type of domain control validation for managed + certificates. Known values are: "CNAME", "HTTP", and "TXT". + :vartype domain_control_validation: str or + ~azure.mgmt.appcontainers.models.ManagedCertificateDomainControlValidation + :ivar validation_token: A TXT token used for DNS TXT domain control validation when issuing + this type of managed certificates. + :vartype validation_token: str + """ + + _validation = { + "provisioning_state": {"readonly": True}, + "error": {"readonly": True}, + "validation_token": {"readonly": True}, + } + + _attribute_map = { + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "subject_name": {"key": "subjectName", "type": "str"}, + "error": {"key": "error", "type": "str"}, + "domain_control_validation": {"key": "domainControlValidation", "type": "str"}, + "validation_token": {"key": "validationToken", "type": "str"}, + } + + def __init__( + self, + *, + subject_name: Optional[str] = None, + domain_control_validation: Optional[Union[str, "_models.ManagedCertificateDomainControlValidation"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword subject_name: Subject name of the certificate. + :paramtype subject_name: str + :keyword domain_control_validation: Selected type of domain control validation for managed + certificates. Known values are: "CNAME", "HTTP", and "TXT". + :paramtype domain_control_validation: str or + ~azure.mgmt.appcontainers.models.ManagedCertificateDomainControlValidation + """ + super().__init__(**kwargs) + self.provisioning_state = None + self.subject_name = subject_name + self.error = None + self.domain_control_validation = domain_control_validation + self.validation_token = None + + +class ManagedEnvironment(TrackedResource): # pylint: disable=too-many-instance-attributes + """An environment for hosting container apps. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar kind: Kind of the Environment. + :vartype kind: str + :ivar identity: Managed identities for the Managed Environment to interact with other Azure + services without maintaining any secrets or credentials in code. + :vartype identity: ~azure.mgmt.appcontainers.models.ManagedServiceIdentity + :ivar provisioning_state: Provisioning state of the Environment. Known values are: "Succeeded", + "Failed", "Canceled", "Waiting", "InitializationInProgress", "InfrastructureSetupInProgress", + "InfrastructureSetupComplete", "ScheduledForDelete", "UpgradeRequested", and "UpgradeFailed". + :vartype provisioning_state: str or + ~azure.mgmt.appcontainers.models.EnvironmentProvisioningState + :ivar dapr_ai_instrumentation_key: Azure Monitor instrumentation key used by Dapr to export + Service to Service communication telemetry. + :vartype dapr_ai_instrumentation_key: str + :ivar dapr_ai_connection_string: Application Insights connection string used by Dapr to export + Service to Service communication telemetry. + :vartype dapr_ai_connection_string: str + :ivar vnet_configuration: Vnet configuration for the environment. + :vartype vnet_configuration: ~azure.mgmt.appcontainers.models.VnetConfiguration + :ivar deployment_errors: Any errors that occurred during deployment or deployment validation. + :vartype deployment_errors: str + :ivar default_domain: Default Domain Name for the cluster. + :vartype default_domain: str + :ivar static_ip: Static IP of the Environment. + :vartype static_ip: str + :ivar app_logs_configuration: Cluster configuration which enables the log daemon to export + app logs to a destination. Currently only "log-analytics" is + supported. + :vartype app_logs_configuration: ~azure.mgmt.appcontainers.models.AppLogsConfiguration + :ivar app_insights_configuration: Environment level Application Insights configuration. + :vartype app_insights_configuration: ~azure.mgmt.appcontainers.models.AppInsightsConfiguration + :ivar open_telemetry_configuration: Environment Open Telemetry configuration. + :vartype open_telemetry_configuration: + ~azure.mgmt.appcontainers.models.OpenTelemetryConfiguration + :ivar zone_redundant: Whether or not this Managed Environment is zone-redundant. + :vartype zone_redundant: bool + :ivar custom_domain_configuration: Custom domain configuration for the environment. + :vartype custom_domain_configuration: + ~azure.mgmt.appcontainers.models.CustomDomainConfiguration + :ivar event_stream_endpoint: The endpoint of the eventstream of the Environment. + :vartype event_stream_endpoint: str + :ivar workload_profiles: Workload profiles configured for the Managed Environment. + :vartype workload_profiles: list[~azure.mgmt.appcontainers.models.WorkloadProfile] + :ivar keda_configuration: The configuration of Keda component. + :vartype keda_configuration: ~azure.mgmt.appcontainers.models.KedaConfiguration + :ivar dapr_configuration: The configuration of Dapr component. + :vartype dapr_configuration: ~azure.mgmt.appcontainers.models.DaprConfiguration + :ivar infrastructure_resource_group: Name of the platform-managed resource group created for + the Managed Environment to host infrastructure resources. If a subnet ID is provided, this + resource group will be created in the same subscription as the subnet. + :vartype infrastructure_resource_group: str + :ivar peer_authentication: Peer authentication settings for the Managed Environment. + :vartype peer_authentication: + ~azure.mgmt.appcontainers.models.ManagedEnvironmentPropertiesPeerAuthentication + :ivar peer_traffic_configuration: Peer traffic settings for the Managed Environment. + :vartype peer_traffic_configuration: + ~azure.mgmt.appcontainers.models.ManagedEnvironmentPropertiesPeerTrafficConfiguration + :ivar private_endpoint_connections: Private endpoint connections to the resource. + :vartype private_endpoint_connections: + list[~azure.mgmt.appcontainers.models.PrivateEndpointConnection] + :ivar public_network_access: Property to allow or block all public traffic. Allowed Values: + 'Enabled', 'Disabled'. Known values are: "Enabled" and "Disabled". + :vartype public_network_access: str or ~azure.mgmt.appcontainers.models.PublicNetworkAccess + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, + "provisioning_state": {"readonly": True}, + "deployment_errors": {"readonly": True}, + "default_domain": {"readonly": True}, + "static_ip": {"readonly": True}, + "event_stream_endpoint": {"readonly": True}, + "private_endpoint_connections": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "kind": {"key": "kind", "type": "str"}, + "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "dapr_ai_instrumentation_key": {"key": "properties.daprAIInstrumentationKey", "type": "str"}, + "dapr_ai_connection_string": {"key": "properties.daprAIConnectionString", "type": "str"}, + "vnet_configuration": {"key": "properties.vnetConfiguration", "type": "VnetConfiguration"}, + "deployment_errors": {"key": "properties.deploymentErrors", "type": "str"}, + "default_domain": {"key": "properties.defaultDomain", "type": "str"}, + "static_ip": {"key": "properties.staticIp", "type": "str"}, + "app_logs_configuration": {"key": "properties.appLogsConfiguration", "type": "AppLogsConfiguration"}, + "app_insights_configuration": { + "key": "properties.appInsightsConfiguration", + "type": "AppInsightsConfiguration", + }, + "open_telemetry_configuration": { + "key": "properties.openTelemetryConfiguration", + "type": "OpenTelemetryConfiguration", + }, + "zone_redundant": {"key": "properties.zoneRedundant", "type": "bool"}, + "custom_domain_configuration": { + "key": "properties.customDomainConfiguration", + "type": "CustomDomainConfiguration", + }, + "event_stream_endpoint": {"key": "properties.eventStreamEndpoint", "type": "str"}, + "workload_profiles": {"key": "properties.workloadProfiles", "type": "[WorkloadProfile]"}, + "keda_configuration": {"key": "properties.kedaConfiguration", "type": "KedaConfiguration"}, + "dapr_configuration": {"key": "properties.daprConfiguration", "type": "DaprConfiguration"}, + "infrastructure_resource_group": {"key": "properties.infrastructureResourceGroup", "type": "str"}, + "peer_authentication": { + "key": "properties.peerAuthentication", + "type": "ManagedEnvironmentPropertiesPeerAuthentication", + }, + "peer_traffic_configuration": { + "key": "properties.peerTrafficConfiguration", + "type": "ManagedEnvironmentPropertiesPeerTrafficConfiguration", + }, + "private_endpoint_connections": { + "key": "properties.privateEndpointConnections", + "type": "[PrivateEndpointConnection]", + }, + "public_network_access": {"key": "properties.publicNetworkAccess", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + kind: Optional[str] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, + dapr_ai_instrumentation_key: Optional[str] = None, + dapr_ai_connection_string: Optional[str] = None, + vnet_configuration: Optional["_models.VnetConfiguration"] = None, + app_logs_configuration: Optional["_models.AppLogsConfiguration"] = None, + app_insights_configuration: Optional["_models.AppInsightsConfiguration"] = None, + open_telemetry_configuration: Optional["_models.OpenTelemetryConfiguration"] = None, + zone_redundant: Optional[bool] = None, + custom_domain_configuration: Optional["_models.CustomDomainConfiguration"] = None, + workload_profiles: Optional[List["_models.WorkloadProfile"]] = None, + keda_configuration: Optional["_models.KedaConfiguration"] = None, + dapr_configuration: Optional["_models.DaprConfiguration"] = None, + infrastructure_resource_group: Optional[str] = None, + peer_authentication: Optional["_models.ManagedEnvironmentPropertiesPeerAuthentication"] = None, + peer_traffic_configuration: Optional["_models.ManagedEnvironmentPropertiesPeerTrafficConfiguration"] = None, + public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str + :keyword kind: Kind of the Environment. + :paramtype kind: str + :keyword identity: Managed identities for the Managed Environment to interact with other Azure + services without maintaining any secrets or credentials in code. + :paramtype identity: ~azure.mgmt.appcontainers.models.ManagedServiceIdentity + :keyword dapr_ai_instrumentation_key: Azure Monitor instrumentation key used by Dapr to export + Service to Service communication telemetry. + :paramtype dapr_ai_instrumentation_key: str + :keyword dapr_ai_connection_string: Application Insights connection string used by Dapr to + export Service to Service communication telemetry. + :paramtype dapr_ai_connection_string: str + :keyword vnet_configuration: Vnet configuration for the environment. + :paramtype vnet_configuration: ~azure.mgmt.appcontainers.models.VnetConfiguration + :keyword app_logs_configuration: Cluster configuration which enables the log daemon to export + app logs to a destination. Currently only "log-analytics" is + supported. + :paramtype app_logs_configuration: ~azure.mgmt.appcontainers.models.AppLogsConfiguration + :keyword app_insights_configuration: Environment level Application Insights configuration. + :paramtype app_insights_configuration: + ~azure.mgmt.appcontainers.models.AppInsightsConfiguration + :keyword open_telemetry_configuration: Environment Open Telemetry configuration. + :paramtype open_telemetry_configuration: + ~azure.mgmt.appcontainers.models.OpenTelemetryConfiguration + :keyword zone_redundant: Whether or not this Managed Environment is zone-redundant. + :paramtype zone_redundant: bool + :keyword custom_domain_configuration: Custom domain configuration for the environment. + :paramtype custom_domain_configuration: + ~azure.mgmt.appcontainers.models.CustomDomainConfiguration + :keyword workload_profiles: Workload profiles configured for the Managed Environment. + :paramtype workload_profiles: list[~azure.mgmt.appcontainers.models.WorkloadProfile] + :keyword keda_configuration: The configuration of Keda component. + :paramtype keda_configuration: ~azure.mgmt.appcontainers.models.KedaConfiguration + :keyword dapr_configuration: The configuration of Dapr component. + :paramtype dapr_configuration: ~azure.mgmt.appcontainers.models.DaprConfiguration + :keyword infrastructure_resource_group: Name of the platform-managed resource group created for + the Managed Environment to host infrastructure resources. If a subnet ID is provided, this + resource group will be created in the same subscription as the subnet. + :paramtype infrastructure_resource_group: str + :keyword peer_authentication: Peer authentication settings for the Managed Environment. + :paramtype peer_authentication: + ~azure.mgmt.appcontainers.models.ManagedEnvironmentPropertiesPeerAuthentication + :keyword peer_traffic_configuration: Peer traffic settings for the Managed Environment. + :paramtype peer_traffic_configuration: + ~azure.mgmt.appcontainers.models.ManagedEnvironmentPropertiesPeerTrafficConfiguration + :keyword public_network_access: Property to allow or block all public traffic. Allowed Values: + 'Enabled', 'Disabled'. Known values are: "Enabled" and "Disabled". + :paramtype public_network_access: str or ~azure.mgmt.appcontainers.models.PublicNetworkAccess + """ + super().__init__(tags=tags, location=location, **kwargs) + self.kind = kind + self.identity = identity + self.provisioning_state = None + self.dapr_ai_instrumentation_key = dapr_ai_instrumentation_key + self.dapr_ai_connection_string = dapr_ai_connection_string + self.vnet_configuration = vnet_configuration + self.deployment_errors = None + self.default_domain = None + self.static_ip = None + self.app_logs_configuration = app_logs_configuration + self.app_insights_configuration = app_insights_configuration + self.open_telemetry_configuration = open_telemetry_configuration + self.zone_redundant = zone_redundant + self.custom_domain_configuration = custom_domain_configuration + self.event_stream_endpoint = None + self.workload_profiles = workload_profiles + self.keda_configuration = keda_configuration + self.dapr_configuration = dapr_configuration + self.infrastructure_resource_group = infrastructure_resource_group + self.peer_authentication = peer_authentication + self.peer_traffic_configuration = peer_traffic_configuration + self.private_endpoint_connections = None + self.public_network_access = public_network_access + + +class ManagedEnvironmentPropertiesPeerAuthentication(_serialization.Model): # pylint: disable=name-too-long + """Peer authentication settings for the Managed Environment. + + :ivar mtls: Mutual TLS authentication settings for the Managed Environment. + :vartype mtls: ~azure.mgmt.appcontainers.models.Mtls + """ + + _attribute_map = { + "mtls": {"key": "mtls", "type": "Mtls"}, + } + + def __init__(self, *, mtls: Optional["_models.Mtls"] = None, **kwargs: Any) -> None: + """ + :keyword mtls: Mutual TLS authentication settings for the Managed Environment. + :paramtype mtls: ~azure.mgmt.appcontainers.models.Mtls + """ + super().__init__(**kwargs) + self.mtls = mtls + + +class ManagedEnvironmentPropertiesPeerTrafficConfiguration(_serialization.Model): # pylint: disable=name-too-long + """Peer traffic settings for the Managed Environment. + + :ivar encryption: Peer traffic encryption settings for the Managed Environment. + :vartype encryption: + ~azure.mgmt.appcontainers.models.ManagedEnvironmentPropertiesPeerTrafficConfigurationEncryption + """ + + _attribute_map = { + "encryption": {"key": "encryption", "type": "ManagedEnvironmentPropertiesPeerTrafficConfigurationEncryption"}, + } + + def __init__( + self, + *, + encryption: Optional["_models.ManagedEnvironmentPropertiesPeerTrafficConfigurationEncryption"] = None, + **kwargs: Any + ) -> None: + """ + :keyword encryption: Peer traffic encryption settings for the Managed Environment. + :paramtype encryption: + ~azure.mgmt.appcontainers.models.ManagedEnvironmentPropertiesPeerTrafficConfigurationEncryption + """ + super().__init__(**kwargs) + self.encryption = encryption + + +class ManagedEnvironmentPropertiesPeerTrafficConfigurationEncryption( + _serialization.Model +): # pylint: disable=name-too-long + """Peer traffic encryption settings for the Managed Environment. + + :ivar enabled: Boolean indicating whether the peer traffic encryption is enabled. + :vartype enabled: bool + """ + + _attribute_map = { + "enabled": {"key": "enabled", "type": "bool"}, + } + + def __init__(self, *, enabled: Optional[bool] = None, **kwargs: Any) -> None: + """ + :keyword enabled: Boolean indicating whether the peer traffic encryption is enabled. + :paramtype enabled: bool + """ + super().__init__(**kwargs) + self.enabled = enabled + + +class ManagedEnvironmentsCollection(_serialization.Model): + """Collection of Environments. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar value: Collection of resources. Required. + :vartype value: list[~azure.mgmt.appcontainers.models.ManagedEnvironment] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[ManagedEnvironment]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.ManagedEnvironment"], **kwargs: Any) -> None: + """ + :keyword value: Collection of resources. Required. + :paramtype value: list[~azure.mgmt.appcontainers.models.ManagedEnvironment] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class ManagedEnvironmentStorage(ProxyResource): + """Storage resource for managedEnvironment. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData + :ivar properties: Storage properties. + :vartype properties: ~azure.mgmt.appcontainers.models.ManagedEnvironmentStorageProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "properties": {"key": "properties", "type": "ManagedEnvironmentStorageProperties"}, + } + + def __init__( + self, *, properties: Optional["_models.ManagedEnvironmentStorageProperties"] = None, **kwargs: Any + ) -> None: + """ + :keyword properties: Storage properties. + :paramtype properties: ~azure.mgmt.appcontainers.models.ManagedEnvironmentStorageProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class ManagedEnvironmentStorageProperties(_serialization.Model): + """Storage properties. + + :ivar azure_file: Azure file properties. + :vartype azure_file: ~azure.mgmt.appcontainers.models.AzureFileProperties + :ivar nfs_azure_file: NFS Azure file properties. + :vartype nfs_azure_file: ~azure.mgmt.appcontainers.models.NfsAzureFileProperties + """ + + _attribute_map = { + "azure_file": {"key": "azureFile", "type": "AzureFileProperties"}, + "nfs_azure_file": {"key": "nfsAzureFile", "type": "NfsAzureFileProperties"}, + } + + def __init__( + self, + *, + azure_file: Optional["_models.AzureFileProperties"] = None, + nfs_azure_file: Optional["_models.NfsAzureFileProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword azure_file: Azure file properties. + :paramtype azure_file: ~azure.mgmt.appcontainers.models.AzureFileProperties + :keyword nfs_azure_file: NFS Azure file properties. + :paramtype nfs_azure_file: ~azure.mgmt.appcontainers.models.NfsAzureFileProperties + """ + super().__init__(**kwargs) + self.azure_file = azure_file + self.nfs_azure_file = nfs_azure_file + + +class ManagedEnvironmentStoragesCollection(_serialization.Model): + """Collection of Storage for Environments. + + All required parameters must be populated in order to send to server. + + :ivar value: Collection of storage resources. Required. + :vartype value: list[~azure.mgmt.appcontainers.models.ManagedEnvironmentStorage] + """ + + _validation = { + "value": {"required": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[ManagedEnvironmentStorage]"}, + } + + def __init__(self, *, value: List["_models.ManagedEnvironmentStorage"], **kwargs: Any) -> None: + """ + :keyword value: Collection of storage resources. Required. + :paramtype value: list[~azure.mgmt.appcontainers.models.ManagedEnvironmentStorage] + """ + super().__init__(**kwargs) + self.value = value + + +class ManagedServiceIdentity(_serialization.Model): + """Managed service identity (system assigned and/or user assigned identities). + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar principal_id: The service principal ID of the system assigned identity. This property + will only be provided for a system assigned identity. + :vartype principal_id: str + :ivar tenant_id: The tenant ID of the system assigned identity. This property will only be + provided for a system assigned identity. + :vartype tenant_id: str + :ivar type: Type of managed service identity (where both SystemAssigned and UserAssigned types + are allowed). Required. Known values are: "None", "SystemAssigned", "UserAssigned", and + "SystemAssigned,UserAssigned". + :vartype type: str or ~azure.mgmt.appcontainers.models.ManagedServiceIdentityType + :ivar user_assigned_identities: The set of user assigned identities associated with the + resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. # pylint: disable=line-too-long + The dictionary values can be empty objects ({}) in requests. + :vartype user_assigned_identities: dict[str, + ~azure.mgmt.appcontainers.models.UserAssignedIdentity] + """ + + _validation = { + "principal_id": {"readonly": True}, + "tenant_id": {"readonly": True}, + "type": {"required": True}, + } + + _attribute_map = { + "principal_id": {"key": "principalId", "type": "str"}, + "tenant_id": {"key": "tenantId", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "user_assigned_identities": {"key": "userAssignedIdentities", "type": "{UserAssignedIdentity}"}, + } + + def __init__( + self, + *, + 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}. # pylint: disable=line-too-long + The dictionary values can be empty objects ({}) in requests. + :paramtype user_assigned_identities: dict[str, + ~azure.mgmt.appcontainers.models.UserAssignedIdentity] + """ + super().__init__(**kwargs) + self.principal_id = None + self.tenant_id = 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 + """ + + _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 = { + "validate_nonce": {"key": "validateNonce", "type": "bool"}, + "nonce_expiration_interval": {"key": "nonceExpirationInterval", "type": "str"}, + } + + def __init__( + self, *, validate_nonce: Optional[bool] = None, nonce_expiration_interval: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword validate_nonce: :code:`false` if the nonce should not be validated while + completing the login flow; otherwise, :code:`true`. + :paramtype validate_nonce: bool + :keyword nonce_expiration_interval: The time after the request is made when the nonce should + expire. + :paramtype nonce_expiration_interval: str + """ + super().__init__(**kwargs) + self.validate_nonce = validate_nonce + self.nonce_expiration_interval = nonce_expiration_interval + + +class OpenIdConnectClientCredential(_serialization.Model): + """The authentication client credentials of the custom Open ID Connect provider. + + :ivar method: The method that should be used to authenticate the user. Default value is + "ClientSecretPost". + :vartype method: str + :ivar client_secret_setting_name: The app setting that contains the client secret for the + custom Open ID Connect provider. + :vartype client_secret_setting_name: str + """ + + _attribute_map = { + "method": {"key": "method", "type": "str"}, + "client_secret_setting_name": {"key": "clientSecretSettingName", "type": "str"}, + } + + def __init__( + self, + *, + method: Optional[Literal["ClientSecretPost"]] = None, + client_secret_setting_name: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword method: The method that should be used to authenticate the user. Default value is + "ClientSecretPost". + :paramtype method: str + :keyword client_secret_setting_name: The app setting that contains the client secret for the + custom Open ID Connect provider. + :paramtype client_secret_setting_name: str + """ + super().__init__(**kwargs) + self.method = method + self.client_secret_setting_name = client_secret_setting_name + + +class OpenIdConnectConfig(_serialization.Model): + """The configuration settings of the endpoints used for the custom Open ID Connect provider. + + :ivar authorization_endpoint: The endpoint to be used to make an authorization request. + :vartype authorization_endpoint: str + :ivar token_endpoint: The endpoint to be used to request a token. + :vartype token_endpoint: str + :ivar issuer: The endpoint that issues the token. + :vartype issuer: str + :ivar certification_uri: The endpoint that provides the keys necessary to validate the token. + :vartype certification_uri: str + :ivar well_known_open_id_configuration: The endpoint that contains all the configuration + endpoints for the provider. + :vartype well_known_open_id_configuration: str + """ + + _attribute_map = { + "authorization_endpoint": {"key": "authorizationEndpoint", "type": "str"}, + "token_endpoint": {"key": "tokenEndpoint", "type": "str"}, + "issuer": {"key": "issuer", "type": "str"}, + "certification_uri": {"key": "certificationUri", "type": "str"}, + "well_known_open_id_configuration": {"key": "wellKnownOpenIdConfiguration", "type": "str"}, + } + + def __init__( + self, + *, + authorization_endpoint: Optional[str] = None, + token_endpoint: Optional[str] = None, + issuer: Optional[str] = None, + certification_uri: Optional[str] = None, + well_known_open_id_configuration: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword image: Container image tag. - :paramtype image: str - :keyword name: Custom container name. - :paramtype name: str - :keyword command: Container start command. - :paramtype command: list[str] - :keyword args: Container start command arguments. - :paramtype args: list[str] - :keyword env: Container environment variables. - :paramtype env: list[~azure.mgmt.appcontainers.models.EnvironmentVar] - :keyword resources: Container resource requirements. - :paramtype resources: ~azure.mgmt.appcontainers.models.ContainerResources + :keyword authorization_endpoint: The endpoint to be used to make an authorization request. + :paramtype authorization_endpoint: str + :keyword token_endpoint: The endpoint to be used to request a token. + :paramtype token_endpoint: str + :keyword issuer: The endpoint that issues the token. + :paramtype issuer: str + :keyword certification_uri: The endpoint that provides the keys necessary to validate the + token. + :paramtype certification_uri: str + :keyword well_known_open_id_configuration: The endpoint that contains all the configuration + endpoints for the provider. + :paramtype well_known_open_id_configuration: str """ super().__init__(**kwargs) - self.image = image - self.name = name - self.command = command - self.args = args - self.env = env - self.resources = resources - + self.authorization_endpoint = authorization_endpoint + self.token_endpoint = token_endpoint + self.issuer = issuer + self.certification_uri = certification_uri + self.well_known_open_id_configuration = well_known_open_id_configuration -class JobExecutionNamesCollection(_serialization.Model): - """Container App executions names list. - All required parameters must be populated in order to send to server. +class OpenIdConnectLogin(_serialization.Model): + """The configuration settings of the login flow of the custom Open ID Connect provider. - :ivar value: Collection of resources. Required. - :vartype value: list[~azure.mgmt.appcontainers.models.JobExecutionBase] + :ivar name_claim_type: The name of the claim that contains the users name. + :vartype name_claim_type: str + :ivar scopes: A list of the scopes that should be requested while authenticating. + :vartype scopes: list[str] """ - _validation = { - "value": {"required": True}, - } - _attribute_map = { - "value": {"key": "value", "type": "[JobExecutionBase]"}, + "name_claim_type": {"key": "nameClaimType", "type": "str"}, + "scopes": {"key": "scopes", "type": "[str]"}, } - def __init__(self, *, value: List["_models.JobExecutionBase"], **kwargs: Any) -> None: + def __init__( + self, *, name_claim_type: Optional[str] = None, scopes: Optional[List[str]] = None, **kwargs: Any + ) -> None: """ - :keyword value: Collection of resources. Required. - :paramtype value: list[~azure.mgmt.appcontainers.models.JobExecutionBase] + :keyword name_claim_type: The name of the claim that contains the users name. + :paramtype name_claim_type: str + :keyword scopes: A list of the scopes that should be requested while authenticating. + :paramtype scopes: list[str] """ super().__init__(**kwargs) - self.value = value + self.name_claim_type = name_claim_type + self.scopes = scopes -class JobExecutionTemplate(_serialization.Model): - """Job's execution template, containing container configuration for a job's execution. +class OpenIdConnectRegistration(_serialization.Model): + """The configuration settings of the app registration for the custom Open ID Connect provider. - :ivar containers: List of container definitions for the Container Apps Job. - :vartype containers: list[~azure.mgmt.appcontainers.models.JobExecutionContainer] - :ivar init_containers: List of specialized containers that run before job containers. - :vartype init_containers: list[~azure.mgmt.appcontainers.models.JobExecutionContainer] + :ivar client_id: The client id of the custom Open ID Connect provider. + :vartype client_id: str + :ivar client_credential: The authentication credentials of the custom Open ID Connect provider. + :vartype client_credential: ~azure.mgmt.appcontainers.models.OpenIdConnectClientCredential + :ivar open_id_connect_configuration: The configuration settings of the endpoints used for the + custom Open ID Connect provider. + :vartype open_id_connect_configuration: ~azure.mgmt.appcontainers.models.OpenIdConnectConfig """ _attribute_map = { - "containers": {"key": "containers", "type": "[JobExecutionContainer]"}, - "init_containers": {"key": "initContainers", "type": "[JobExecutionContainer]"}, + "client_id": {"key": "clientId", "type": "str"}, + "client_credential": {"key": "clientCredential", "type": "OpenIdConnectClientCredential"}, + "open_id_connect_configuration": {"key": "openIdConnectConfiguration", "type": "OpenIdConnectConfig"}, } def __init__( self, *, - containers: Optional[List["_models.JobExecutionContainer"]] = None, - init_containers: Optional[List["_models.JobExecutionContainer"]] = None, + client_id: Optional[str] = None, + client_credential: Optional["_models.OpenIdConnectClientCredential"] = None, + open_id_connect_configuration: Optional["_models.OpenIdConnectConfig"] = None, **kwargs: Any ) -> None: """ - :keyword containers: List of container definitions for the Container Apps Job. - :paramtype containers: list[~azure.mgmt.appcontainers.models.JobExecutionContainer] - :keyword init_containers: List of specialized containers that run before job containers. - :paramtype init_containers: list[~azure.mgmt.appcontainers.models.JobExecutionContainer] + :keyword client_id: The client id of the custom Open ID Connect provider. + :paramtype client_id: str + :keyword client_credential: The authentication credentials of the custom Open ID Connect + provider. + :paramtype client_credential: ~azure.mgmt.appcontainers.models.OpenIdConnectClientCredential + :keyword open_id_connect_configuration: The configuration settings of the endpoints used for + the custom Open ID Connect provider. + :paramtype open_id_connect_configuration: ~azure.mgmt.appcontainers.models.OpenIdConnectConfig """ super().__init__(**kwargs) - self.containers = containers - self.init_containers = init_containers + self.client_id = client_id + self.client_credential = client_credential + self.open_id_connect_configuration = open_id_connect_configuration -class JobPatchProperties(_serialization.Model): - """Container Apps Job resource specific properties. +class OpenTelemetryConfiguration(_serialization.Model): + """Configuration of Open Telemetry. - :ivar identity: Managed identities needed by a container app job to interact with other Azure - services to not maintain any secrets or credentials in code. - :vartype identity: ~azure.mgmt.appcontainers.models.ManagedServiceIdentity - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar properties: - :vartype properties: ~azure.mgmt.appcontainers.models.JobPatchPropertiesProperties + :ivar destinations_configuration: Open telemetry destinations configuration. + :vartype destinations_configuration: ~azure.mgmt.appcontainers.models.DestinationsConfiguration + :ivar traces_configuration: Open telemetry trace configuration. + :vartype traces_configuration: ~azure.mgmt.appcontainers.models.TracesConfiguration + :ivar logs_configuration: Open telemetry logs configuration. + :vartype logs_configuration: ~azure.mgmt.appcontainers.models.LogsConfiguration + :ivar metrics_configuration: Open telemetry metrics configuration. + :vartype metrics_configuration: ~azure.mgmt.appcontainers.models.MetricsConfiguration """ _attribute_map = { - "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, - "tags": {"key": "tags", "type": "{str}"}, - "properties": {"key": "properties", "type": "JobPatchPropertiesProperties"}, + "destinations_configuration": {"key": "destinationsConfiguration", "type": "DestinationsConfiguration"}, + "traces_configuration": {"key": "tracesConfiguration", "type": "TracesConfiguration"}, + "logs_configuration": {"key": "logsConfiguration", "type": "LogsConfiguration"}, + "metrics_configuration": {"key": "metricsConfiguration", "type": "MetricsConfiguration"}, } def __init__( self, *, - identity: Optional["_models.ManagedServiceIdentity"] = None, - tags: Optional[Dict[str, str]] = None, - properties: Optional["_models.JobPatchPropertiesProperties"] = None, + destinations_configuration: Optional["_models.DestinationsConfiguration"] = None, + traces_configuration: Optional["_models.TracesConfiguration"] = None, + logs_configuration: Optional["_models.LogsConfiguration"] = None, + metrics_configuration: Optional["_models.MetricsConfiguration"] = None, **kwargs: Any ) -> None: """ - :keyword identity: Managed identities needed by a container app job to interact with other - Azure services to not maintain any secrets or credentials in code. - :paramtype identity: ~azure.mgmt.appcontainers.models.ManagedServiceIdentity - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword properties: - :paramtype properties: ~azure.mgmt.appcontainers.models.JobPatchPropertiesProperties + :keyword destinations_configuration: Open telemetry destinations configuration. + :paramtype destinations_configuration: + ~azure.mgmt.appcontainers.models.DestinationsConfiguration + :keyword traces_configuration: Open telemetry trace configuration. + :paramtype traces_configuration: ~azure.mgmt.appcontainers.models.TracesConfiguration + :keyword logs_configuration: Open telemetry logs configuration. + :paramtype logs_configuration: ~azure.mgmt.appcontainers.models.LogsConfiguration + :keyword metrics_configuration: Open telemetry metrics configuration. + :paramtype metrics_configuration: ~azure.mgmt.appcontainers.models.MetricsConfiguration """ super().__init__(**kwargs) - self.identity = identity - self.tags = tags - self.properties = properties + self.destinations_configuration = destinations_configuration + self.traces_configuration = traces_configuration + self.logs_configuration = logs_configuration + self.metrics_configuration = metrics_configuration -class JobPatchPropertiesProperties(_serialization.Model): - """JobPatchPropertiesProperties. +class OperationDetail(_serialization.Model): + """Operation detail payload. - :ivar environment_id: Resource ID of environment. - :vartype environment_id: str - :ivar configuration: Container Apps Job configuration properties. - :vartype configuration: ~azure.mgmt.appcontainers.models.JobConfiguration - :ivar template: Container Apps job definition. - :vartype template: ~azure.mgmt.appcontainers.models.JobTemplate - :ivar outbound_ip_addresses: Outbound IP Addresses of a container apps job. - :vartype outbound_ip_addresses: list[str] - :ivar event_stream_endpoint: The endpoint of the eventstream of the container apps job. - :vartype event_stream_endpoint: str + :ivar name: Name of the operation. + :vartype name: str + :ivar is_data_action: Indicates whether the operation is a data action. + :vartype is_data_action: bool + :ivar display: Display of the operation. + :vartype display: ~azure.mgmt.appcontainers.models.OperationDisplay + :ivar origin: Origin of the operation. + :vartype origin: str """ _attribute_map = { - "environment_id": {"key": "environmentId", "type": "str"}, - "configuration": {"key": "configuration", "type": "JobConfiguration"}, - "template": {"key": "template", "type": "JobTemplate"}, - "outbound_ip_addresses": {"key": "outboundIpAddresses", "type": "[str]"}, - "event_stream_endpoint": {"key": "eventStreamEndpoint", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "is_data_action": {"key": "isDataAction", "type": "bool"}, + "display": {"key": "display", "type": "OperationDisplay"}, + "origin": {"key": "origin", "type": "str"}, } def __init__( self, *, - environment_id: Optional[str] = None, - configuration: Optional["_models.JobConfiguration"] = None, - template: Optional["_models.JobTemplate"] = None, - outbound_ip_addresses: Optional[List[str]] = None, - event_stream_endpoint: Optional[str] = None, + name: Optional[str] = None, + is_data_action: Optional[bool] = None, + display: Optional["_models.OperationDisplay"] = None, + origin: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword environment_id: Resource ID of environment. - :paramtype environment_id: str - :keyword configuration: Container Apps Job configuration properties. - :paramtype configuration: ~azure.mgmt.appcontainers.models.JobConfiguration - :keyword template: Container Apps job definition. - :paramtype template: ~azure.mgmt.appcontainers.models.JobTemplate - :keyword outbound_ip_addresses: Outbound IP Addresses of a container apps job. - :paramtype outbound_ip_addresses: list[str] - :keyword event_stream_endpoint: The endpoint of the eventstream of the container apps job. - :paramtype event_stream_endpoint: str + :keyword name: Name of the operation. + :paramtype name: str + :keyword is_data_action: Indicates whether the operation is a data action. + :paramtype is_data_action: bool + :keyword display: Display of the operation. + :paramtype display: ~azure.mgmt.appcontainers.models.OperationDisplay + :keyword origin: Origin of the operation. + :paramtype origin: str """ super().__init__(**kwargs) - self.environment_id = environment_id - self.configuration = configuration - self.template = template - self.outbound_ip_addresses = outbound_ip_addresses - self.event_stream_endpoint = event_stream_endpoint + self.name = name + self.is_data_action = is_data_action + self.display = display + self.origin = origin -class JobScale(_serialization.Model): - """Scaling configurations for event driven jobs. +class OperationDisplay(_serialization.Model): + """Operation display payload. - :ivar polling_interval: Interval to check each event source in seconds. Defaults to 30s. - :vartype polling_interval: int - :ivar min_executions: Minimum number of job executions that are created for a trigger, default - 0. - :vartype min_executions: int - :ivar max_executions: Maximum number of job executions that are created for a trigger, default - 100. - :vartype max_executions: int - :ivar rules: Scaling rules. - :vartype rules: list[~azure.mgmt.appcontainers.models.JobScaleRule] + :ivar provider: Resource provider of the operation. + :vartype provider: str + :ivar resource: Resource of the operation. + :vartype resource: str + :ivar operation: Localized friendly name for the operation. + :vartype operation: str + :ivar description: Localized friendly description for the operation. + :vartype description: str """ _attribute_map = { - "polling_interval": {"key": "pollingInterval", "type": "int"}, - "min_executions": {"key": "minExecutions", "type": "int"}, - "max_executions": {"key": "maxExecutions", "type": "int"}, - "rules": {"key": "rules", "type": "[JobScaleRule]"}, + "provider": {"key": "provider", "type": "str"}, + "resource": {"key": "resource", "type": "str"}, + "operation": {"key": "operation", "type": "str"}, + "description": {"key": "description", "type": "str"}, } def __init__( self, *, - polling_interval: Optional[int] = None, - min_executions: int = 0, - max_executions: int = 100, - rules: Optional[List["_models.JobScaleRule"]] = None, + provider: Optional[str] = None, + resource: Optional[str] = None, + operation: Optional[str] = None, + description: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword polling_interval: Interval to check each event source in seconds. Defaults to 30s. - :paramtype polling_interval: int - :keyword min_executions: Minimum number of job executions that are created for a trigger, - default 0. - :paramtype min_executions: int - :keyword max_executions: Maximum number of job executions that are created for a trigger, - default 100. - :paramtype max_executions: int - :keyword rules: Scaling rules. - :paramtype rules: list[~azure.mgmt.appcontainers.models.JobScaleRule] + :keyword provider: Resource provider of the operation. + :paramtype provider: str + :keyword resource: Resource of the operation. + :paramtype resource: str + :keyword operation: Localized friendly name for the operation. + :paramtype operation: str + :keyword description: Localized friendly description for the operation. + :paramtype description: str """ super().__init__(**kwargs) - self.polling_interval = polling_interval - self.min_executions = min_executions - self.max_executions = max_executions - self.rules = rules + self.provider = provider + self.resource = resource + self.operation = operation + self.description = description -class JobScaleRule(_serialization.Model): - """Scaling rule. +class OtlpConfiguration(_serialization.Model): + """Configuration of otlp. - :ivar name: Scale Rule Name. + :ivar name: The name of otlp configuration. :vartype name: str - :ivar type: Type of the scale rule - eg: azure-servicebus, redis etc. - :vartype type: str - :ivar metadata: Metadata properties to describe the scale rule. - :vartype metadata: JSON - :ivar auth: Authentication secrets for the scale rule. - :vartype auth: list[~azure.mgmt.appcontainers.models.ScaleRuleAuth] + :ivar endpoint: The endpoint of otlp configuration. + :vartype endpoint: str + :ivar insecure: Boolean indicating if otlp configuration is insecure. + :vartype insecure: bool + :ivar headers: Headers of otlp configurations. + :vartype headers: list[~azure.mgmt.appcontainers.models.Header] """ _attribute_map = { "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "metadata": {"key": "metadata", "type": "object"}, - "auth": {"key": "auth", "type": "[ScaleRuleAuth]"}, + "endpoint": {"key": "endpoint", "type": "str"}, + "insecure": {"key": "insecure", "type": "bool"}, + "headers": {"key": "headers", "type": "[Header]"}, } def __init__( self, *, name: Optional[str] = None, - type: Optional[str] = None, - metadata: Optional[JSON] = None, - auth: Optional[List["_models.ScaleRuleAuth"]] = None, + endpoint: Optional[str] = None, + insecure: Optional[bool] = None, + headers: Optional[List["_models.Header"]] = None, **kwargs: Any ) -> None: """ - :keyword name: Scale Rule Name. + :keyword name: The name of otlp configuration. :paramtype name: str - :keyword type: Type of the scale rule - eg: azure-servicebus, redis etc. - :paramtype type: str - :keyword metadata: Metadata properties to describe the scale rule. - :paramtype metadata: JSON - :keyword auth: Authentication secrets for the scale rule. - :paramtype auth: list[~azure.mgmt.appcontainers.models.ScaleRuleAuth] + :keyword endpoint: The endpoint of otlp configuration. + :paramtype endpoint: str + :keyword insecure: Boolean indicating if otlp configuration is insecure. + :paramtype insecure: bool + :keyword headers: Headers of otlp configurations. + :paramtype headers: list[~azure.mgmt.appcontainers.models.Header] """ super().__init__(**kwargs) self.name = name - self.type = type - self.metadata = metadata - self.auth = auth - + self.endpoint = endpoint + self.insecure = insecure + self.headers = headers -class JobsCollection(_serialization.Model): - """Container Apps Jobs collection ARM resource. - Variables are only populated by the server, and will be ignored when sending a request. +class PatchCollection(_serialization.Model): + """Container App patch collection. All required parameters must be populated in order to send to server. - :ivar value: Collection of resources. Required. - :vartype value: list[~azure.mgmt.appcontainers.models.Job] - :ivar next_link: Link to next page of resources. + :ivar value: Collection of patch resources. Required. + :vartype value: list[~azure.mgmt.appcontainers.models.ContainerAppsPatchResource] + :ivar next_link: the link to the next page of items. :vartype next_link: str """ _validation = { "value": {"required": True}, - "next_link": {"readonly": True}, } _attribute_map = { - "value": {"key": "value", "type": "[Job]"}, + "value": {"key": "value", "type": "[ContainerAppsPatchResource]"}, "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: List["_models.Job"], **kwargs: Any) -> None: + def __init__( + self, *, value: List["_models.ContainerAppsPatchResource"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ - :keyword value: Collection of resources. Required. - :paramtype value: list[~azure.mgmt.appcontainers.models.Job] + :keyword value: Collection of patch resources. Required. + :paramtype value: list[~azure.mgmt.appcontainers.models.ContainerAppsPatchResource] + :keyword next_link: the link to the next page of items. + :paramtype next_link: str """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link = next_link -class JobSecretsCollection(_serialization.Model): - """Container Apps Job Secrets Collection ARM resource. +class PatchDetails(_serialization.Model): + """The detailed info of patch operation performing when applying a patch. + + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to server. - :ivar value: Collection of resources. Required. - :vartype value: list[~azure.mgmt.appcontainers.models.Secret] + :ivar target_container_name: The name of the target container for the patch. Required. + :vartype target_container_name: str + :ivar target_image: The name of the target image for the patch. Required. + :vartype target_image: str + :ivar last_detection_time: The UTC timestamp that describes the latest detection was done. + Required. + :vartype last_detection_time: ~datetime.datetime + :ivar detection_status: The status of the patch detection. Required. Known values are: + "Succeeded", "RegistryLoginFailed", and "Failed". + :vartype detection_status: str or ~azure.mgmt.appcontainers.models.DetectionStatus + :ivar new_image_name: The name of the new image created by the patch. + :vartype new_image_name: str + :ivar new_layer: New layer update details in the target image. + :vartype new_layer: ~azure.mgmt.appcontainers.models.PatchDetailsNewLayer + :ivar old_layer: The old layer details in the target image. + :vartype old_layer: ~azure.mgmt.appcontainers.models.PatchDetailsOldLayer + :ivar patch_type: The type for the patch. Known values are: "FrameworkSecurity", "OSSecurity", + "FrameworkAndOSSecurity", and "Other". + :vartype patch_type: str or ~azure.mgmt.appcontainers.models.PatchType """ _validation = { - "value": {"required": True}, + "target_container_name": {"required": True, "readonly": True}, + "target_image": {"required": True, "readonly": True}, + "last_detection_time": {"required": True, "readonly": True}, + "detection_status": {"required": True, "readonly": True}, + "new_image_name": {"readonly": True}, + "new_layer": {"readonly": True}, + "old_layer": {"readonly": True}, + "patch_type": {"readonly": True}, } _attribute_map = { - "value": {"key": "value", "type": "[Secret]"}, + "target_container_name": {"key": "targetContainerName", "type": "str"}, + "target_image": {"key": "targetImage", "type": "str"}, + "last_detection_time": {"key": "lastDetectionTime", "type": "iso-8601"}, + "detection_status": {"key": "detectionStatus", "type": "str"}, + "new_image_name": {"key": "newImageName", "type": "str"}, + "new_layer": {"key": "newLayer", "type": "PatchDetailsNewLayer"}, + "old_layer": {"key": "oldLayer", "type": "PatchDetailsOldLayer"}, + "patch_type": {"key": "patchType", "type": "str"}, } - def __init__(self, *, value: List["_models.Secret"], **kwargs: Any) -> None: - """ - :keyword value: Collection of resources. Required. - :paramtype value: list[~azure.mgmt.appcontainers.models.Secret] - """ + def __init__(self, **kwargs: Any) -> None: + """ """ super().__init__(**kwargs) - self.value = value + self.target_container_name = None + self.target_image = None + self.last_detection_time = None + self.detection_status = None + self.new_image_name = None + self.new_layer = None + self.old_layer = None + self.patch_type = None -class JobTemplate(_serialization.Model): - """Container Apps Job versioned application definition. Defines the desired state of an immutable - revision. Any changes to this section Will result in a new revision being created. +class PatchDetailsNewLayer(_serialization.Model): + """New layer update details in the target image. - :ivar init_containers: List of specialized containers that run before app containers. - :vartype init_containers: list[~azure.mgmt.appcontainers.models.InitContainer] - :ivar containers: List of container definitions for the Container App. - :vartype containers: list[~azure.mgmt.appcontainers.models.Container] - :ivar volumes: List of volume definitions for the Container App. - :vartype volumes: list[~azure.mgmt.appcontainers.models.Volume] + :ivar name: The details of the new layer for the target image. + :vartype name: str + :ivar framework_and_version: The framework and its version in the new run image for the target + image. + :vartype framework_and_version: str + :ivar os_and_version: The OS name and its version in the new run image for the target image. + :vartype os_and_version: str """ _attribute_map = { - "init_containers": {"key": "initContainers", "type": "[InitContainer]"}, - "containers": {"key": "containers", "type": "[Container]"}, - "volumes": {"key": "volumes", "type": "[Volume]"}, + "name": {"key": "name", "type": "str"}, + "framework_and_version": {"key": "frameworkAndVersion", "type": "str"}, + "os_and_version": {"key": "osAndVersion", "type": "str"}, } def __init__( self, *, - init_containers: Optional[List["_models.InitContainer"]] = None, - containers: Optional[List["_models.Container"]] = None, - volumes: Optional[List["_models.Volume"]] = None, + name: Optional[str] = None, + framework_and_version: Optional[str] = None, + os_and_version: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword init_containers: List of specialized containers that run before app containers. - :paramtype init_containers: list[~azure.mgmt.appcontainers.models.InitContainer] - :keyword containers: List of container definitions for the Container App. - :paramtype containers: list[~azure.mgmt.appcontainers.models.Container] - :keyword volumes: List of volume definitions for the Container App. - :paramtype volumes: list[~azure.mgmt.appcontainers.models.Volume] + :keyword name: The details of the new layer for the target image. + :paramtype name: str + :keyword framework_and_version: The framework and its version in the new run image for the + target image. + :paramtype framework_and_version: str + :keyword os_and_version: The OS name and its version in the new run image for the target image. + :paramtype os_and_version: str """ super().__init__(**kwargs) - self.init_containers = init_containers - self.containers = containers - self.volumes = volumes + self.name = name + self.framework_and_version = framework_and_version + self.os_and_version = os_and_version -class JwtClaimChecks(_serialization.Model): - """The configuration settings of the checks that should be made while validating the JWT Claims. +class PatchDetailsOldLayer(_serialization.Model): + """The old layer details in the target image. - :ivar allowed_groups: The list of the allowed groups. - :vartype allowed_groups: list[str] - :ivar allowed_client_applications: The list of the allowed client applications. - :vartype allowed_client_applications: list[str] + :ivar name: The details of the old layer for the target image. + :vartype name: str + :ivar framework_and_version: The framework and its version in the old run image for the target + image. + :vartype framework_and_version: str + :ivar os_and_version: The OS name and its version in the old run image for the target image. + :vartype os_and_version: str """ _attribute_map = { - "allowed_groups": {"key": "allowedGroups", "type": "[str]"}, - "allowed_client_applications": {"key": "allowedClientApplications", "type": "[str]"}, + "name": {"key": "name", "type": "str"}, + "framework_and_version": {"key": "frameworkAndVersion", "type": "str"}, + "os_and_version": {"key": "osAndVersion", "type": "str"}, } def __init__( self, *, - allowed_groups: Optional[List[str]] = None, - allowed_client_applications: Optional[List[str]] = None, + name: Optional[str] = None, + framework_and_version: Optional[str] = None, + os_and_version: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword allowed_groups: The list of the allowed groups. - :paramtype allowed_groups: list[str] - :keyword allowed_client_applications: The list of the allowed client applications. - :paramtype allowed_client_applications: list[str] + :keyword name: The details of the old layer for the target image. + :paramtype name: str + :keyword framework_and_version: The framework and its version in the old run image for the + target image. + :paramtype framework_and_version: str + :keyword os_and_version: The OS name and its version in the old run image for the target image. + :paramtype os_and_version: str """ super().__init__(**kwargs) - self.allowed_groups = allowed_groups - self.allowed_client_applications = allowed_client_applications + self.name = name + self.framework_and_version = framework_and_version + self.os_and_version = os_and_version -class KedaConfiguration(_serialization.Model): - """Configuration properties Keda component. +class PatchProperties(_serialization.Model): + """Top level properties that describes current states of the patch resource. Variables are only populated by the server, and will be ignored when sending a request. - :ivar version: The version of Keda. - :vartype version: str + :ivar target_environment_id: The Azure resource id of the target environment for the patch. + :vartype target_environment_id: str + :ivar target_container_app_id: The Azure resource id of the target container app for the patch. + :vartype target_container_app_id: str + :ivar target_revision_id: The Azure resource id of the target revision for the patch. + :vartype target_revision_id: str + :ivar patch_apply_status: The status of the patch operation. Known values are: "NotStarted", + "RebaseInProgress", "CreatingRevision", "Succeeded", "Canceled", "RebaseFailed", + "RevisionCreationFailed", "ImagePushPullFailed", and "ManuallySkipped". + :vartype patch_apply_status: str or ~azure.mgmt.appcontainers.models.PatchApplyStatus + :ivar created_at: The UTC timestamp that describes when the patch object was created. + :vartype created_at: ~datetime.datetime + :ivar last_modified_at: The UTC timestamp that describes when the patch object was last + updated. + :vartype last_modified_at: ~datetime.datetime + :ivar patch_details: Detailed info describes the patch operation for the target container app. + :vartype patch_details: list[~azure.mgmt.appcontainers.models.PatchDetails] """ _validation = { - "version": {"readonly": True}, - } - - _attribute_map = { - "version": {"key": "version", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.version = None - - -class ListUsagesResult(_serialization.Model): - """ListUsagesResult. - - :ivar value: The list of compute resource usages. - :vartype value: list[~azure.mgmt.appcontainers.models.Usage] - :ivar next_link: The URI to fetch the next page of compute resource usage information. Call - ListNext() with this to fetch the next page of compute resource usage information. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[Usage]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.Usage"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The list of compute resource usages. - :paramtype value: list[~azure.mgmt.appcontainers.models.Usage] - :keyword next_link: The URI to fetch the next page of compute resource usage information. Call - ListNext() with this to fetch the next page of compute resource usage information. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class LogAnalyticsConfiguration(_serialization.Model): - """Log Analytics configuration, must only be provided when destination is configured as - 'log-analytics'. - - :ivar customer_id: Log analytics customer id. - :vartype customer_id: str - :ivar shared_key: Log analytics customer key. - :vartype shared_key: str - """ - - _attribute_map = { - "customer_id": {"key": "customerId", "type": "str"}, - "shared_key": {"key": "sharedKey", "type": "str"}, + "patch_apply_status": {"readonly": True}, + "created_at": {"readonly": True}, + "last_modified_at": {"readonly": True}, + "patch_details": {"readonly": True}, } - def __init__(self, *, customer_id: Optional[str] = None, shared_key: Optional[str] = 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 - """ - super().__init__(**kwargs) - self.customer_id = customer_id - self.shared_key = shared_key - - -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"}, + "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, - *, - 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 + *, + target_environment_id: Optional[str] = None, + target_container_app_id: Optional[str] = None, + target_revision_id: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword target_environment_id: The Azure resource id of the target environment for the patch. + :paramtype target_environment_id: str + :keyword target_container_app_id: The Azure resource id of the target container app for the + patch. + :paramtype target_container_app_id: str + :keyword target_revision_id: The Azure resource id of the target revision for the patch. + :paramtype target_revision_id: str """ super().__init__(**kwargs) - self.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.target_environment_id = target_environment_id + self.target_container_app_id = target_container_app_id + self.target_revision_id = target_revision_id + self.patch_apply_status = None + self.created_at = None + self.last_modified_at = None + self.patch_details = None -class LoginRoutes(_serialization.Model): - """The routes that specify the endpoints used for login and logout requests. +class PatchSkipConfig(_serialization.Model): + """The configuration for patcher to skip a patch or not. - :ivar logout_endpoint: The endpoint at which a logout request should be made. - :vartype logout_endpoint: str + :ivar skip: The flag to indicate whether to skip the patch or not. + :vartype skip: bool """ _attribute_map = { - "logout_endpoint": {"key": "logoutEndpoint", "type": "str"}, + "skip": {"key": "skip", "type": "bool"}, } - def __init__(self, *, logout_endpoint: Optional[str] = None, **kwargs: Any) -> None: + def __init__(self, *, skip: Optional[bool] = None, **kwargs: Any) -> None: """ - :keyword logout_endpoint: The endpoint at which a logout request should be made. - :paramtype logout_endpoint: str + :keyword skip: The flag to indicate whether to skip the patch or not. + :paramtype skip: bool """ super().__init__(**kwargs) - self.logout_endpoint = logout_endpoint + self.skip = skip -class LoginScopes(_serialization.Model): - """The configuration settings of the login flow, including the scopes that should be requested. +class PreBuildStep(_serialization.Model): + """Model representing a pre-build step. - :ivar scopes: A list of the scopes that should be requested while authenticating. - :vartype scopes: list[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 = { - "scopes": {"key": "scopes", "type": "[str]"}, + "description": {"key": "description", "type": "str"}, + "scripts": {"key": "scripts", "type": "[str]"}, + "http_get": {"key": "httpGet", "type": "HttpGet"}, } - def __init__(self, *, scopes: Optional[List[str]] = None, **kwargs: Any) -> None: + def __init__( + self, + *, + description: Optional[str] = None, + scripts: Optional[List[str]] = None, + http_get: Optional["_models.HttpGet"] = None, + **kwargs: Any + ) -> None: """ - :keyword scopes: A list of the scopes that should be requested while authenticating. - :paramtype scopes: list[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.scopes = scopes + self.description = description + self.scripts = scripts + self.http_get = http_get -class ManagedCertificate(TrackedResource): - """Managed certificates used for Custom Domain bindings of Container Apps in a Managed - Environment. +class PrivateEndpoint(_serialization.Model): + """The Private Endpoint 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: The ARM identifier for Private Endpoint. + :vartype id: str + """ - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + _validation = { + "id": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.id = None + + +class PrivateEndpointConnection(Resource): + """The Private Endpoint Connection resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -6126,12 +10436,19 @@ class ManagedCertificate(TrackedResource): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar properties: Certificate resource specific properties. - :vartype properties: ~azure.mgmt.appcontainers.models.ManagedCertificateProperties + :ivar group_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 = { @@ -6139,7 +10456,8 @@ class ManagedCertificate(TrackedResource): "name": {"readonly": True}, "type": {"readonly": True}, "system_data": {"readonly": True}, - "location": {"required": True}, + "group_ids": {"readonly": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { @@ -6147,152 +10465,348 @@ class ManagedCertificate(TrackedResource): "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, "system_data": {"key": "systemData", "type": "SystemData"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "properties": {"key": "properties", "type": "ManagedCertificateProperties"}, + "group_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, *, - location: str, - tags: Optional[Dict[str, str]] = None, - properties: Optional["_models.ManagedCertificateProperties"] = None, + private_endpoint: Optional["_models.PrivateEndpoint"] = None, + private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionState"] = 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 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__(tags=tags, location=location, **kwargs) - self.properties = properties + super().__init__(**kwargs) + self.group_ids = None + self.private_endpoint = private_endpoint + self.private_link_service_connection_state = private_link_service_connection_state + self.provisioning_state = None -class ManagedCertificateCollection(_serialization.Model): - """Collection of Managed Certificates. +class PrivateEndpointConnectionListResult(_serialization.Model): + """List of private endpoint connection associated with the specified 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: 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 + """ - :ivar value: Collection of resources. Required. - :vartype value: list[~azure.mgmt.appcontainers.models.ManagedCertificate] - :ivar next_link: Link to next page of resources. + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[PrivateEndpointConnection]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: Optional[List["_models.PrivateEndpointConnection"]] = None, **kwargs: Any) -> None: + """ + :keyword value: Array of private endpoint connections. + :paramtype value: list[~azure.mgmt.appcontainers.models.PrivateEndpointConnection] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class PrivateLinkResource(Resource): + """A private link resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData + :ivar group_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 = { + "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, *, required_zone_names: Optional[List[str]] = None, **kwargs: Any) -> None: + """ + :keyword required_zone_names: The private link resource private link DNS zone name. + :paramtype required_zone_names: list[str] + """ + super().__init__(**kwargs) + self.group_id = None + self.required_members = None + self.required_zone_names = required_zone_names + + +class PrivateLinkResourceListResult(_serialization.Model): + """A list of private link resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: Array of private link resources. + :vartype value: list[~azure.mgmt.appcontainers.models.PrivateLinkResource] + :ivar next_link: URL to get the next set of operation list results (if there are any). :vartype next_link: str """ _validation = { - "value": {"required": True}, "next_link": {"readonly": True}, } _attribute_map = { - "value": {"key": "value", "type": "[ManagedCertificate]"}, + "value": {"key": "value", "type": "[PrivateLinkResource]"}, "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: List["_models.ManagedCertificate"], **kwargs: Any) -> None: + def __init__(self, *, value: Optional[List["_models.PrivateLinkResource"]] = None, **kwargs: Any) -> None: """ - :keyword value: Collection of resources. Required. - :paramtype value: list[~azure.mgmt.appcontainers.models.ManagedCertificate] + :keyword value: Array of private link resources. + :paramtype value: list[~azure.mgmt.appcontainers.models.PrivateLinkResource] """ super().__init__(**kwargs) self.value = value self.next_link = None -class ManagedCertificatePatch(_serialization.Model): - """A managed certificate to update. +class PrivateLinkServiceConnectionState(_serialization.Model): + """A collection of information about the state of the connection between service consumer and + provider. - :ivar tags: Application-specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] + :ivar status: Indicates whether the connection has been Approved/Rejected/Removed by the owner + of the service. Known values are: "Pending", "Approved", "Rejected", and "Disconnected". + :vartype status: str or ~azure.mgmt.appcontainers.models.PrivateEndpointServiceConnectionStatus + :ivar description: The reason for approval/rejection of the connection. + :vartype description: str + :ivar actions_required: A message indicating if changes on the service provider require any + updates on the consumer. + :vartype actions_required: str """ _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, + "status": {"key": "status", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "actions_required": {"key": "actionsRequired", "type": "str"}, } - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: + def __init__( + self, + *, + status: Optional[Union[str, "_models.PrivateEndpointServiceConnectionStatus"]] = None, + description: Optional[str] = None, + actions_required: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword status: Indicates whether the connection has been Approved/Rejected/Removed by the + owner of the service. Known values are: "Pending", "Approved", "Rejected", and "Disconnected". + :paramtype status: str or + ~azure.mgmt.appcontainers.models.PrivateEndpointServiceConnectionStatus + :keyword description: The reason for approval/rejection of the connection. + :paramtype description: str + :keyword actions_required: A message indicating if changes on the service provider require any + updates on the consumer. + :paramtype actions_required: str + """ + super().__init__(**kwargs) + self.status = status + self.description = description + self.actions_required = actions_required + + +class QueueScaleRule(_serialization.Model): + """Container App container Azure Queue based scaling rule. + + :ivar account_name: Storage account name. required if using managed identity to authenticate. + :vartype account_name: str + :ivar queue_name: Queue name. + :vartype queue_name: str + :ivar queue_length: Queue length. + :vartype queue_length: int + :ivar auth: Authentication secrets for the queue scale rule. + :vartype auth: list[~azure.mgmt.appcontainers.models.ScaleRuleAuth] + :ivar identity: The resource ID of a user-assigned managed identity that is assigned to the + Container App, or 'system' for system-assigned identity. + :vartype identity: str + """ + + _attribute_map = { + "account_name": {"key": "accountName", "type": "str"}, + "queue_name": {"key": "queueName", "type": "str"}, + "queue_length": {"key": "queueLength", "type": "int"}, + "auth": {"key": "auth", "type": "[ScaleRuleAuth]"}, + "identity": {"key": "identity", "type": "str"}, + } + + def __init__( + self, + *, + account_name: Optional[str] = None, + queue_name: Optional[str] = None, + queue_length: Optional[int] = None, + auth: Optional[List["_models.ScaleRuleAuth"]] = None, + identity: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword account_name: Storage account name. required if using managed identity to + authenticate. + :paramtype account_name: str + :keyword queue_name: Queue name. + :paramtype queue_name: str + :keyword queue_length: Queue length. + :paramtype queue_length: int + :keyword auth: Authentication secrets for the queue scale rule. + :paramtype auth: list[~azure.mgmt.appcontainers.models.ScaleRuleAuth] + :keyword identity: The resource ID of a user-assigned managed identity that is assigned to the + Container App, or 'system' for system-assigned identity. + :paramtype identity: str + """ + super().__init__(**kwargs) + self.account_name = account_name + self.queue_name = queue_name + self.queue_length = queue_length + self.auth = auth + self.identity = identity + + +class RegistryCredentials(_serialization.Model): + """Container App Private Registry. + + :ivar server: Container Registry Server. + :vartype server: str + :ivar username: Container Registry Username. + :vartype username: str + :ivar password_secret_ref: The name of the Secret that contains the registry login password. + :vartype password_secret_ref: str + :ivar identity: A Managed Identity to use to authenticate with Azure Container Registry. For + user-assigned identities, use the full user-assigned identity Resource ID. For system-assigned + identities, use 'system'. + :vartype identity: str + """ + + _attribute_map = { + "server": {"key": "server", "type": "str"}, + "username": {"key": "username", "type": "str"}, + "password_secret_ref": {"key": "passwordSecretRef", "type": "str"}, + "identity": {"key": "identity", "type": "str"}, + } + + def __init__( + self, + *, + server: Optional[str] = None, + username: Optional[str] = None, + password_secret_ref: Optional[str] = None, + identity: Optional[str] = None, + **kwargs: Any + ) -> None: """ - :keyword tags: Application-specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] + :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.tags = tags - + self.server = server + self.username = username + self.password_secret_ref = password_secret_ref + self.identity = identity -class ManagedCertificateProperties(_serialization.Model): - """Certificate resource specific properties. - Variables are only populated by the server, and will be ignored when sending a request. +class RegistryInfo(_serialization.Model): + """Container App registry information. - :ivar provisioning_state: Provisioning state of the certificate. Known values are: "Succeeded", - "Failed", "Canceled", "DeleteFailed", and "Pending". - :vartype provisioning_state: str or - ~azure.mgmt.appcontainers.models.CertificateProvisioningState - :ivar subject_name: Subject name of the certificate. - :vartype subject_name: str - :ivar error: Any error occurred during the certificate provision. - :vartype error: str - :ivar domain_control_validation: Selected type of domain control validation for managed - certificates. Known values are: "CNAME", "HTTP", and "TXT". - :vartype domain_control_validation: str or - ~azure.mgmt.appcontainers.models.ManagedCertificateDomainControlValidation - :ivar validation_token: A TXT token used for DNS TXT domain control validation when issuing - this type of managed certificates. - :vartype validation_token: str + :ivar registry_url: registry server Url. + :vartype registry_url: str + :ivar registry_user_name: registry username. + :vartype registry_user_name: str + :ivar registry_password: registry secret. + :vartype registry_password: str """ - _validation = { - "provisioning_state": {"readonly": True}, - "error": {"readonly": True}, - "validation_token": {"readonly": True}, - } - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "subject_name": {"key": "subjectName", "type": "str"}, - "error": {"key": "error", "type": "str"}, - "domain_control_validation": {"key": "domainControlValidation", "type": "str"}, - "validation_token": {"key": "validationToken", "type": "str"}, + "registry_url": {"key": "registryUrl", "type": "str"}, + "registry_user_name": {"key": "registryUserName", "type": "str"}, + "registry_password": {"key": "registryPassword", "type": "str"}, } def __init__( self, *, - subject_name: Optional[str] = None, - domain_control_validation: Optional[Union[str, "_models.ManagedCertificateDomainControlValidation"]] = None, + registry_url: Optional[str] = None, + registry_user_name: Optional[str] = None, + registry_password: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword subject_name: Subject name of the certificate. - :paramtype subject_name: str - :keyword domain_control_validation: Selected type of domain control validation for managed - certificates. Known values are: "CNAME", "HTTP", and "TXT". - :paramtype domain_control_validation: str or - ~azure.mgmt.appcontainers.models.ManagedCertificateDomainControlValidation + :keyword registry_url: registry server Url. + :paramtype registry_url: str + :keyword registry_user_name: registry username. + :paramtype registry_user_name: str + :keyword registry_password: registry secret. + :paramtype registry_password: str """ super().__init__(**kwargs) - self.provisioning_state = None - self.subject_name = subject_name - self.error = None - self.domain_control_validation = domain_control_validation - self.validation_token = None + self.registry_url = registry_url + self.registry_user_name = registry_user_name + self.registry_password = registry_password -class ManagedEnvironment(TrackedResource): # pylint: disable=too-many-instance-attributes - """An environment for hosting container apps. +class Replica(ProxyResource): + """Container App Revision Replica. Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to server. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -6302,58 +10816,17 @@ class ManagedEnvironment(TrackedResource): # pylint: disable=too-many-instance- :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar kind: Kind of the Environment. - :vartype kind: str - :ivar provisioning_state: Provisioning state of the Environment. Known values are: "Succeeded", - "Failed", "Canceled", "Waiting", "InitializationInProgress", "InfrastructureSetupInProgress", - "InfrastructureSetupComplete", "ScheduledForDelete", "UpgradeRequested", and "UpgradeFailed". - :vartype provisioning_state: str or - ~azure.mgmt.appcontainers.models.EnvironmentProvisioningState - :ivar dapr_ai_instrumentation_key: Azure Monitor instrumentation key used by Dapr to export - Service to Service communication telemetry. - :vartype dapr_ai_instrumentation_key: str - :ivar dapr_ai_connection_string: Application Insights connection string used by Dapr to export - Service to Service communication telemetry. - :vartype dapr_ai_connection_string: str - :ivar vnet_configuration: Vnet configuration for the environment. - :vartype vnet_configuration: ~azure.mgmt.appcontainers.models.VnetConfiguration - :ivar deployment_errors: Any errors that occurred during deployment or deployment validation. - :vartype deployment_errors: str - :ivar default_domain: Default Domain Name for the cluster. - :vartype default_domain: str - :ivar static_ip: Static IP of the Environment. - :vartype static_ip: str - :ivar app_logs_configuration: Cluster configuration which enables the log daemon to export - app logs to a destination. Currently only "log-analytics" is - supported. - :vartype app_logs_configuration: ~azure.mgmt.appcontainers.models.AppLogsConfiguration - :ivar zone_redundant: Whether or not this Managed Environment is zone-redundant. - :vartype zone_redundant: bool - :ivar custom_domain_configuration: Custom domain configuration for the environment. - :vartype custom_domain_configuration: - ~azure.mgmt.appcontainers.models.CustomDomainConfiguration - :ivar event_stream_endpoint: The endpoint of the eventstream of the Environment. - :vartype event_stream_endpoint: str - :ivar workload_profiles: Workload profiles configured for the Managed Environment. - :vartype workload_profiles: list[~azure.mgmt.appcontainers.models.WorkloadProfile] - :ivar keda_configuration: The configuration of Keda component. - :vartype keda_configuration: ~azure.mgmt.appcontainers.models.KedaConfiguration - :ivar dapr_configuration: The configuration of Dapr component. - :vartype dapr_configuration: ~azure.mgmt.appcontainers.models.DaprConfiguration - :ivar infrastructure_resource_group: Name of the platform-managed resource group created for - the Managed Environment to host infrastructure resources. If a subnet ID is provided, this - resource group will be created in the same subscription as the subnet. - :vartype infrastructure_resource_group: str - :ivar peer_authentication: Peer authentication settings for the Managed Environment. - :vartype peer_authentication: - ~azure.mgmt.appcontainers.models.ManagedEnvironmentPropertiesPeerAuthentication - :ivar peer_traffic_configuration: Peer traffic settings for the Managed Environment. - :vartype peer_traffic_configuration: - ~azure.mgmt.appcontainers.models.ManagedEnvironmentPropertiesPeerTrafficConfiguration + :ivar created_time: Timestamp describing when the pod was created by controller. + :vartype created_time: ~datetime.datetime + :ivar running_state: Current running state of the replica. Known values are: "Running", + "NotRunning", and "Unknown". + :vartype running_state: str or ~azure.mgmt.appcontainers.models.ContainerAppReplicaRunningState + :ivar running_state_details: The details of replica current running state. + :vartype running_state_details: str + :ivar containers: The containers collection under a replica. + :vartype containers: list[~azure.mgmt.appcontainers.models.ReplicaContainer] + :ivar init_containers: The init containers collection under a replica. + :vartype init_containers: list[~azure.mgmt.appcontainers.models.ReplicaContainer] """ _validation = { @@ -6361,12 +10834,9 @@ class ManagedEnvironment(TrackedResource): # pylint: disable=too-many-instance- "name": {"readonly": True}, "type": {"readonly": True}, "system_data": {"readonly": True}, - "location": {"required": True}, - "provisioning_state": {"readonly": True}, - "deployment_errors": {"readonly": True}, - "default_domain": {"readonly": True}, - "static_ip": {"readonly": True}, - "event_stream_endpoint": {"readonly": True}, + "created_time": {"readonly": True}, + "running_state": {"readonly": True}, + "running_state_details": {"readonly": True}, } _attribute_map = { @@ -6374,197 +10844,285 @@ class ManagedEnvironment(TrackedResource): # pylint: disable=too-many-instance- "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, "system_data": {"key": "systemData", "type": "SystemData"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "kind": {"key": "kind", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "dapr_ai_instrumentation_key": {"key": "properties.daprAIInstrumentationKey", "type": "str"}, - "dapr_ai_connection_string": {"key": "properties.daprAIConnectionString", "type": "str"}, - "vnet_configuration": {"key": "properties.vnetConfiguration", "type": "VnetConfiguration"}, - "deployment_errors": {"key": "properties.deploymentErrors", "type": "str"}, - "default_domain": {"key": "properties.defaultDomain", "type": "str"}, - "static_ip": {"key": "properties.staticIp", "type": "str"}, - "app_logs_configuration": {"key": "properties.appLogsConfiguration", "type": "AppLogsConfiguration"}, - "zone_redundant": {"key": "properties.zoneRedundant", "type": "bool"}, - "custom_domain_configuration": { - "key": "properties.customDomainConfiguration", - "type": "CustomDomainConfiguration", - }, - "event_stream_endpoint": {"key": "properties.eventStreamEndpoint", "type": "str"}, - "workload_profiles": {"key": "properties.workloadProfiles", "type": "[WorkloadProfile]"}, - "keda_configuration": {"key": "properties.kedaConfiguration", "type": "KedaConfiguration"}, - "dapr_configuration": {"key": "properties.daprConfiguration", "type": "DaprConfiguration"}, - "infrastructure_resource_group": {"key": "properties.infrastructureResourceGroup", "type": "str"}, - "peer_authentication": { - "key": "properties.peerAuthentication", - "type": "ManagedEnvironmentPropertiesPeerAuthentication", - }, - "peer_traffic_configuration": { - "key": "properties.peerTrafficConfiguration", - "type": "ManagedEnvironmentPropertiesPeerTrafficConfiguration", - }, + "created_time": {"key": "properties.createdTime", "type": "iso-8601"}, + "running_state": {"key": "properties.runningState", "type": "str"}, + "running_state_details": {"key": "properties.runningStateDetails", "type": "str"}, + "containers": {"key": "properties.containers", "type": "[ReplicaContainer]"}, + "init_containers": {"key": "properties.initContainers", "type": "[ReplicaContainer]"}, } - def __init__( # pylint: disable=too-many-locals + def __init__( self, *, - location: str, - tags: Optional[Dict[str, str]] = None, - kind: Optional[str] = None, - dapr_ai_instrumentation_key: Optional[str] = None, - dapr_ai_connection_string: Optional[str] = None, - vnet_configuration: Optional["_models.VnetConfiguration"] = None, - app_logs_configuration: Optional["_models.AppLogsConfiguration"] = None, - zone_redundant: Optional[bool] = None, - custom_domain_configuration: Optional["_models.CustomDomainConfiguration"] = None, - workload_profiles: Optional[List["_models.WorkloadProfile"]] = None, - keda_configuration: Optional["_models.KedaConfiguration"] = None, - dapr_configuration: Optional["_models.DaprConfiguration"] = None, - infrastructure_resource_group: Optional[str] = None, - peer_authentication: Optional["_models.ManagedEnvironmentPropertiesPeerAuthentication"] = None, - peer_traffic_configuration: Optional["_models.ManagedEnvironmentPropertiesPeerTrafficConfiguration"] = None, + containers: Optional[List["_models.ReplicaContainer"]] = None, + init_containers: Optional[List["_models.ReplicaContainer"]] = None, **kwargs: Any ) -> None: """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - :keyword kind: Kind of the Environment. - :paramtype kind: str - :keyword dapr_ai_instrumentation_key: Azure Monitor instrumentation key used by Dapr to export - Service to Service communication telemetry. - :paramtype dapr_ai_instrumentation_key: str - :keyword dapr_ai_connection_string: Application Insights connection string used by Dapr to - export Service to Service communication telemetry. - :paramtype dapr_ai_connection_string: str - :keyword vnet_configuration: Vnet configuration for the environment. - :paramtype vnet_configuration: ~azure.mgmt.appcontainers.models.VnetConfiguration - :keyword app_logs_configuration: Cluster configuration which enables the log daemon to export - app logs to a destination. Currently only "log-analytics" is - supported. - :paramtype app_logs_configuration: ~azure.mgmt.appcontainers.models.AppLogsConfiguration - :keyword zone_redundant: Whether or not this Managed Environment is zone-redundant. - :paramtype zone_redundant: bool - :keyword custom_domain_configuration: Custom domain configuration for the environment. - :paramtype custom_domain_configuration: - ~azure.mgmt.appcontainers.models.CustomDomainConfiguration - :keyword workload_profiles: Workload profiles configured for the Managed Environment. - :paramtype workload_profiles: list[~azure.mgmt.appcontainers.models.WorkloadProfile] - :keyword keda_configuration: The configuration of Keda component. - :paramtype keda_configuration: ~azure.mgmt.appcontainers.models.KedaConfiguration - :keyword dapr_configuration: The configuration of Dapr component. - :paramtype dapr_configuration: ~azure.mgmt.appcontainers.models.DaprConfiguration - :keyword infrastructure_resource_group: Name of the platform-managed resource group created for - the Managed Environment to host infrastructure resources. If a subnet ID is provided, this - resource group will be created in the same subscription as the subnet. - :paramtype infrastructure_resource_group: str - :keyword peer_authentication: Peer authentication settings for the Managed Environment. - :paramtype peer_authentication: - ~azure.mgmt.appcontainers.models.ManagedEnvironmentPropertiesPeerAuthentication - :keyword peer_traffic_configuration: Peer traffic settings for the Managed Environment. - :paramtype peer_traffic_configuration: - ~azure.mgmt.appcontainers.models.ManagedEnvironmentPropertiesPeerTrafficConfiguration + :keyword containers: The containers collection under a replica. + :paramtype containers: list[~azure.mgmt.appcontainers.models.ReplicaContainer] + :keyword init_containers: The init containers collection under a replica. + :paramtype init_containers: list[~azure.mgmt.appcontainers.models.ReplicaContainer] """ - super().__init__(tags=tags, location=location, **kwargs) - self.kind = kind - self.provisioning_state = None - self.dapr_ai_instrumentation_key = dapr_ai_instrumentation_key - self.dapr_ai_connection_string = dapr_ai_connection_string - self.vnet_configuration = vnet_configuration - self.deployment_errors = None - self.default_domain = None - self.static_ip = None - self.app_logs_configuration = app_logs_configuration - self.zone_redundant = zone_redundant - self.custom_domain_configuration = custom_domain_configuration - self.event_stream_endpoint = None - self.workload_profiles = workload_profiles - self.keda_configuration = keda_configuration - self.dapr_configuration = dapr_configuration - self.infrastructure_resource_group = infrastructure_resource_group - self.peer_authentication = peer_authentication - self.peer_traffic_configuration = peer_traffic_configuration + super().__init__(**kwargs) + self.created_time = None + self.running_state = None + self.running_state_details = None + self.containers = containers + self.init_containers = init_containers -class ManagedEnvironmentPropertiesPeerAuthentication(_serialization.Model): # pylint: disable=name-too-long - """Peer authentication settings for the Managed Environment. +class ReplicaCollection(_serialization.Model): + """Container App Revision Replicas collection ARM resource. - :ivar mtls: Mutual TLS authentication settings for the Managed Environment. - :vartype mtls: ~azure.mgmt.appcontainers.models.Mtls + All required parameters must be populated in order to send to server. + + :ivar value: Collection of resources. Required. + :vartype value: list[~azure.mgmt.appcontainers.models.Replica] """ + _validation = { + "value": {"required": True}, + } + _attribute_map = { - "mtls": {"key": "mtls", "type": "Mtls"}, + "value": {"key": "value", "type": "[Replica]"}, } - def __init__(self, *, mtls: Optional["_models.Mtls"] = None, **kwargs: Any) -> None: + def __init__(self, *, value: List["_models.Replica"], **kwargs: Any) -> None: """ - :keyword mtls: Mutual TLS authentication settings for the Managed Environment. - :paramtype mtls: ~azure.mgmt.appcontainers.models.Mtls + :keyword value: Collection of resources. Required. + :paramtype value: list[~azure.mgmt.appcontainers.models.Replica] """ super().__init__(**kwargs) - self.mtls = mtls + self.value = value -class ManagedEnvironmentPropertiesPeerTrafficConfiguration(_serialization.Model): # pylint: disable=name-too-long - """Peer traffic settings for the Managed Environment. +class ReplicaContainer(_serialization.Model): + """Container object under Container App Revision Replica. - :ivar encryption: Peer traffic encryption settings for the Managed Environment. - :vartype encryption: - ~azure.mgmt.appcontainers.models.ManagedEnvironmentPropertiesPeerTrafficConfigurationEncryption + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: The Name of the Container. + :vartype name: str + :ivar container_id: The Id of the Container. + :vartype container_id: str + :ivar ready: The container ready status. + :vartype ready: bool + :ivar started: The container start status. + :vartype started: bool + :ivar restart_count: The container restart count. + :vartype restart_count: int + :ivar running_state: Current running state of the container. Known values are: "Running", + "Terminated", and "Waiting". + :vartype running_state: str or + ~azure.mgmt.appcontainers.models.ContainerAppContainerRunningState + :ivar running_state_details: The details of container current running state. + :vartype running_state_details: str + :ivar log_stream_endpoint: Log Stream endpoint. + :vartype log_stream_endpoint: str + :ivar exec_endpoint: Container exec endpoint. + :vartype exec_endpoint: str + :ivar debug_endpoint: Container debug endpoint. + :vartype debug_endpoint: str """ + _validation = { + "running_state": {"readonly": True}, + "running_state_details": {"readonly": True}, + "log_stream_endpoint": {"readonly": True}, + "exec_endpoint": {"readonly": True}, + "debug_endpoint": {"readonly": True}, + } + _attribute_map = { - "encryption": {"key": "encryption", "type": "ManagedEnvironmentPropertiesPeerTrafficConfigurationEncryption"}, + "name": {"key": "name", "type": "str"}, + "container_id": {"key": "containerId", "type": "str"}, + "ready": {"key": "ready", "type": "bool"}, + "started": {"key": "started", "type": "bool"}, + "restart_count": {"key": "restartCount", "type": "int"}, + "running_state": {"key": "runningState", "type": "str"}, + "running_state_details": {"key": "runningStateDetails", "type": "str"}, + "log_stream_endpoint": {"key": "logStreamEndpoint", "type": "str"}, + "exec_endpoint": {"key": "execEndpoint", "type": "str"}, + "debug_endpoint": {"key": "debugEndpoint", "type": "str"}, } def __init__( self, *, - encryption: Optional["_models.ManagedEnvironmentPropertiesPeerTrafficConfigurationEncryption"] = None, + name: Optional[str] = None, + container_id: Optional[str] = None, + ready: Optional[bool] = None, + started: Optional[bool] = None, + restart_count: Optional[int] = None, **kwargs: Any ) -> None: """ - :keyword encryption: Peer traffic encryption settings for the Managed Environment. - :paramtype encryption: - ~azure.mgmt.appcontainers.models.ManagedEnvironmentPropertiesPeerTrafficConfigurationEncryption + :keyword name: The Name of the Container. + :paramtype name: str + :keyword container_id: The Id of the Container. + :paramtype container_id: str + :keyword ready: The container ready status. + :paramtype ready: bool + :keyword started: The container start status. + :paramtype started: bool + :keyword restart_count: The container restart count. + :paramtype restart_count: int """ super().__init__(**kwargs) - self.encryption = encryption + self.name = name + self.container_id = container_id + self.ready = ready + self.started = started + self.restart_count = restart_count + self.running_state = None + self.running_state_details = None + self.log_stream_endpoint = None + self.exec_endpoint = None + self.debug_endpoint = None -class ManagedEnvironmentPropertiesPeerTrafficConfigurationEncryption( - _serialization.Model -): # pylint: disable=name-too-long - """Peer traffic encryption settings for the Managed Environment. +class ReplicaExecutionStatus(_serialization.Model): + """Container Apps Job execution replica status. - :ivar enabled: Boolean indicating whether the peer traffic encryption is enabled. - :vartype enabled: bool + :ivar name: Replica Name. + :vartype name: str + :ivar containers: Containers in the execution replica. + :vartype containers: list[~azure.mgmt.appcontainers.models.ContainerExecutionStatus] """ _attribute_map = { - "enabled": {"key": "enabled", "type": "bool"}, + "name": {"key": "name", "type": "str"}, + "containers": {"key": "containers", "type": "[ContainerExecutionStatus]"}, } - def __init__(self, *, enabled: Optional[bool] = None, **kwargs: Any) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + containers: Optional[List["_models.ContainerExecutionStatus"]] = None, + **kwargs: Any + ) -> None: """ - :keyword enabled: Boolean indicating whether the peer traffic encryption is enabled. - :paramtype enabled: bool + :keyword name: Replica Name. + :paramtype name: str + :keyword containers: Containers in the execution replica. + :paramtype containers: list[~azure.mgmt.appcontainers.models.ContainerExecutionStatus] """ super().__init__(**kwargs) - self.enabled = enabled + self.name = name + self.containers = containers -class ManagedEnvironmentsCollection(_serialization.Model): - """Collection of Environments. +class Revision(ProxyResource): # pylint: disable=too-many-instance-attributes + """Container App Revision. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData + :ivar created_time: Timestamp describing when the revision was created + by controller. + :vartype created_time: ~datetime.datetime + :ivar last_active_time: Timestamp describing when the revision was last active. Only meaningful + when revision is inactive. + :vartype last_active_time: ~datetime.datetime + :ivar fqdn: Fully qualified domain name of the revision. + :vartype fqdn: str + :ivar template: Container App Revision Template with all possible settings and the + defaults if user did not provide them. The defaults are populated + as they were at the creation time. + :vartype template: ~azure.mgmt.appcontainers.models.Template + :ivar active: Boolean describing if the Revision is Active. + :vartype active: bool + :ivar replicas: Number of pods currently running for this revision. + :vartype replicas: int + :ivar traffic_weight: Traffic weight assigned to this revision. + :vartype traffic_weight: int + :ivar provisioning_error: Optional Field - Platform Error Message. + :vartype provisioning_error: str + :ivar health_state: Current health State of the revision. Known values are: "Healthy", + "Unhealthy", and "None". + :vartype health_state: str or ~azure.mgmt.appcontainers.models.RevisionHealthState + :ivar provisioning_state: Current provisioning State of the revision. Known values are: + "Provisioning", "Provisioned", "Failed", "Deprovisioning", and "Deprovisioned". + :vartype provisioning_state: str or ~azure.mgmt.appcontainers.models.RevisionProvisioningState + :ivar running_state: Current running state of the revision. Known values are: "Running", + "Processing", "Stopped", "Degraded", "Failed", and "Unknown". + :vartype running_state: str or ~azure.mgmt.appcontainers.models.RevisionRunningState + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "created_time": {"readonly": True}, + "last_active_time": {"readonly": True}, + "fqdn": {"readonly": True}, + "template": {"readonly": True}, + "active": {"readonly": True}, + "replicas": {"readonly": True}, + "traffic_weight": {"readonly": True}, + "provisioning_error": {"readonly": True}, + "health_state": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "running_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "created_time": {"key": "properties.createdTime", "type": "iso-8601"}, + "last_active_time": {"key": "properties.lastActiveTime", "type": "iso-8601"}, + "fqdn": {"key": "properties.fqdn", "type": "str"}, + "template": {"key": "properties.template", "type": "Template"}, + "active": {"key": "properties.active", "type": "bool"}, + "replicas": {"key": "properties.replicas", "type": "int"}, + "traffic_weight": {"key": "properties.trafficWeight", "type": "int"}, + "provisioning_error": {"key": "properties.provisioningError", "type": "str"}, + "health_state": {"key": "properties.healthState", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "running_state": {"key": "properties.runningState", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.created_time = None + self.last_active_time = None + self.fqdn = None + self.template = None + self.active = None + self.replicas = None + self.traffic_weight = None + self.provisioning_error = None + self.health_state = None + self.provisioning_state = None + self.running_state = None + + +class RevisionCollection(_serialization.Model): + """Container App Revisions collection ARM resource. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to server. :ivar value: Collection of resources. Required. - :vartype value: list[~azure.mgmt.appcontainers.models.ManagedEnvironment] + :vartype value: list[~azure.mgmt.appcontainers.models.Revision] :ivar next_link: Link to next page of resources. :vartype next_link: str """ @@ -6575,795 +11133,697 @@ class ManagedEnvironmentsCollection(_serialization.Model): } _attribute_map = { - "value": {"key": "value", "type": "[ManagedEnvironment]"}, + "value": {"key": "value", "type": "[Revision]"}, "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: List["_models.ManagedEnvironment"], **kwargs: Any) -> None: + def __init__(self, *, value: List["_models.Revision"], **kwargs: Any) -> None: """ :keyword value: Collection of resources. Required. - :paramtype value: list[~azure.mgmt.appcontainers.models.ManagedEnvironment] + :paramtype value: list[~azure.mgmt.appcontainers.models.Revision] """ super().__init__(**kwargs) self.value = value self.next_link = None -class ManagedEnvironmentStorage(ProxyResource): - """Storage resource for managedEnvironment. - - Variables are only populated by the server, and will be ignored when sending a request. +class Runtime(_serialization.Model): + """Container App Runtime configuration. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData - :ivar properties: Storage properties. - :vartype properties: ~azure.mgmt.appcontainers.models.ManagedEnvironmentStorageProperties + :ivar java: Java app configuration. + :vartype java: ~azure.mgmt.appcontainers.models.RuntimeJava + :ivar dotnet: .NET app configuration. + :vartype dotnet: ~azure.mgmt.appcontainers.models.RuntimeDotnet """ - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - } - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "properties": {"key": "properties", "type": "ManagedEnvironmentStorageProperties"}, + "java": {"key": "java", "type": "RuntimeJava"}, + "dotnet": {"key": "dotnet", "type": "RuntimeDotnet"}, } def __init__( - self, *, properties: Optional["_models.ManagedEnvironmentStorageProperties"] = None, **kwargs: Any + self, + *, + java: Optional["_models.RuntimeJava"] = None, + dotnet: Optional["_models.RuntimeDotnet"] = None, + **kwargs: Any ) -> None: """ - :keyword properties: Storage properties. - :paramtype properties: ~azure.mgmt.appcontainers.models.ManagedEnvironmentStorageProperties + :keyword java: Java app configuration. + :paramtype java: ~azure.mgmt.appcontainers.models.RuntimeJava + :keyword dotnet: .NET app configuration. + :paramtype dotnet: ~azure.mgmt.appcontainers.models.RuntimeDotnet """ super().__init__(**kwargs) - self.properties = properties + self.java = java + self.dotnet = dotnet -class ManagedEnvironmentStorageProperties(_serialization.Model): - """Storage properties. +class RuntimeDotnet(_serialization.Model): + """.NET app configuration. - :ivar azure_file: Azure file properties. - :vartype azure_file: ~azure.mgmt.appcontainers.models.AzureFileProperties + :ivar auto_configure_data_protection: Auto configure the ASP.NET Core Data Protection feature. + :vartype auto_configure_data_protection: bool """ _attribute_map = { - "azure_file": {"key": "azureFile", "type": "AzureFileProperties"}, + "auto_configure_data_protection": {"key": "autoConfigureDataProtection", "type": "bool"}, } - def __init__(self, *, azure_file: Optional["_models.AzureFileProperties"] = None, **kwargs: Any) -> None: + def __init__(self, *, auto_configure_data_protection: Optional[bool] = None, **kwargs: Any) -> None: """ - :keyword azure_file: Azure file properties. - :paramtype azure_file: ~azure.mgmt.appcontainers.models.AzureFileProperties + :keyword auto_configure_data_protection: Auto configure the ASP.NET Core Data Protection + feature. + :paramtype auto_configure_data_protection: bool """ super().__init__(**kwargs) - self.azure_file = azure_file - + self.auto_configure_data_protection = auto_configure_data_protection -class ManagedEnvironmentStoragesCollection(_serialization.Model): - """Collection of Storage for Environments. - All required parameters must be populated in order to send to server. +class RuntimeJava(_serialization.Model): + """Java app configuration. - :ivar value: Collection of storage resources. Required. - :vartype value: list[~azure.mgmt.appcontainers.models.ManagedEnvironmentStorage] + :ivar enable_metrics: Enable jmx core metrics for the java app. + :vartype enable_metrics: bool + :ivar java_agent: Diagnostic capabilities achieved by java agent. + :vartype java_agent: ~azure.mgmt.appcontainers.models.RuntimeJavaAgent """ - _validation = { - "value": {"required": True}, - } - _attribute_map = { - "value": {"key": "value", "type": "[ManagedEnvironmentStorage]"}, + "enable_metrics": {"key": "enableMetrics", "type": "bool"}, + "java_agent": {"key": "javaAgent", "type": "RuntimeJavaAgent"}, } - def __init__(self, *, value: List["_models.ManagedEnvironmentStorage"], **kwargs: Any) -> None: + def __init__( + self, + *, + enable_metrics: Optional[bool] = None, + java_agent: Optional["_models.RuntimeJavaAgent"] = None, + **kwargs: Any + ) -> None: """ - :keyword value: Collection of storage resources. Required. - :paramtype value: list[~azure.mgmt.appcontainers.models.ManagedEnvironmentStorage] + :keyword enable_metrics: Enable jmx core metrics for the java app. + :paramtype enable_metrics: bool + :keyword java_agent: Diagnostic capabilities achieved by java agent. + :paramtype java_agent: ~azure.mgmt.appcontainers.models.RuntimeJavaAgent """ super().__init__(**kwargs) - self.value = value - + self.enable_metrics = enable_metrics + self.java_agent = java_agent -class ManagedServiceIdentity(_serialization.Model): - """Managed service identity (system assigned and/or user assigned identities). - - Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to server. +class RuntimeJavaAgent(_serialization.Model): + """Diagnostic capabilities achieved by java agent. - :ivar principal_id: The service principal ID of the system assigned identity. This property - will only be provided for a system assigned identity. - :vartype principal_id: str - :ivar tenant_id: The tenant ID of the system assigned identity. This property will only be - provided for a system assigned identity. - :vartype tenant_id: str - :ivar type: Type of managed service identity (where both SystemAssigned and UserAssigned types - are allowed). Required. Known values are: "None", "SystemAssigned", "UserAssigned", and - "SystemAssigned,UserAssigned". - :vartype type: str or ~azure.mgmt.appcontainers.models.ManagedServiceIdentityType - :ivar user_assigned_identities: The set of user assigned identities associated with the - resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. # pylint: disable=line-too-long - The dictionary values can be empty objects ({}) in requests. - :vartype user_assigned_identities: dict[str, - ~azure.mgmt.appcontainers.models.UserAssignedIdentity] + :ivar enabled: Enable java agent injection for the java app. + :vartype enabled: bool + :ivar logging: Capabilities on the java logging scenario. + :vartype logging: ~azure.mgmt.appcontainers.models.RuntimeJavaAgentLogging """ - _validation = { - "principal_id": {"readonly": True}, - "tenant_id": {"readonly": True}, - "type": {"required": True}, - } - _attribute_map = { - "principal_id": {"key": "principalId", "type": "str"}, - "tenant_id": {"key": "tenantId", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "user_assigned_identities": {"key": "userAssignedIdentities", "type": "{UserAssignedIdentity}"}, + "enabled": {"key": "enabled", "type": "bool"}, + "logging": {"key": "logging", "type": "RuntimeJavaAgentLogging"}, } def __init__( self, *, - type: Union[str, "_models.ManagedServiceIdentityType"], - user_assigned_identities: Optional[Dict[str, "_models.UserAssignedIdentity"]] = None, + enabled: Optional[bool] = None, + logging: Optional["_models.RuntimeJavaAgentLogging"] = None, **kwargs: Any ) -> None: """ - :keyword type: Type of managed service identity (where both SystemAssigned and UserAssigned - types are allowed). Required. Known values are: "None", "SystemAssigned", "UserAssigned", and - "SystemAssigned,UserAssigned". - :paramtype type: str or ~azure.mgmt.appcontainers.models.ManagedServiceIdentityType - :keyword user_assigned_identities: The set of user assigned identities associated with the - resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. # pylint: disable=line-too-long - The dictionary values can be empty objects ({}) in requests. - :paramtype user_assigned_identities: dict[str, - ~azure.mgmt.appcontainers.models.UserAssignedIdentity] + :keyword enabled: Enable java agent injection for the java app. + :paramtype enabled: bool + :keyword logging: Capabilities on the java logging scenario. + :paramtype logging: ~azure.mgmt.appcontainers.models.RuntimeJavaAgentLogging """ super().__init__(**kwargs) - self.principal_id = None - self.tenant_id = None - self.type = type - self.user_assigned_identities = user_assigned_identities + self.enabled = enabled + self.logging = logging -class Mtls(_serialization.Model): - """Configuration properties for mutual TLS authentication. +class RuntimeJavaAgentLogging(_serialization.Model): + """Capabilities on the java logging scenario. - :ivar enabled: Boolean indicating whether the mutual TLS authentication is enabled. - :vartype enabled: bool + :ivar logger_settings: Settings of the logger for the java app. + :vartype logger_settings: list[~azure.mgmt.appcontainers.models.LoggerSetting] """ _attribute_map = { - "enabled": {"key": "enabled", "type": "bool"}, + "logger_settings": {"key": "loggerSettings", "type": "[LoggerSetting]"}, } - def __init__(self, *, enabled: Optional[bool] = None, **kwargs: Any) -> None: + def __init__(self, *, logger_settings: Optional[List["_models.LoggerSetting"]] = None, **kwargs: Any) -> None: """ - :keyword enabled: Boolean indicating whether the mutual TLS authentication is enabled. - :paramtype enabled: bool + :keyword logger_settings: Settings of the logger for the java app. + :paramtype logger_settings: list[~azure.mgmt.appcontainers.models.LoggerSetting] """ super().__init__(**kwargs) - self.enabled = enabled + self.logger_settings = logger_settings -class Nonce(_serialization.Model): - """The configuration settings of the nonce used in the login flow. +class Scale(_serialization.Model): + """Container App scaling configurations. - :ivar validate_nonce: :code:`false` if the nonce should not be validated while - completing the login flow; otherwise, :code:`true`. - :vartype validate_nonce: bool - :ivar nonce_expiration_interval: The time after the request is made when the nonce should - expire. - :vartype nonce_expiration_interval: str + :ivar min_replicas: Optional. Minimum number of container replicas. + :vartype min_replicas: int + :ivar max_replicas: Optional. Maximum number of container replicas. Defaults to 10 if not set. + :vartype max_replicas: int + :ivar cooldown_period: Optional. KEDA Cooldown Period. Defaults to 300 seconds if not set. + :vartype cooldown_period: int + :ivar polling_interval: Optional. KEDA Polling Interval. Defaults to 30 seconds if not set. + :vartype polling_interval: int + :ivar rules: Scaling rules. + :vartype rules: list[~azure.mgmt.appcontainers.models.ScaleRule] """ _attribute_map = { - "validate_nonce": {"key": "validateNonce", "type": "bool"}, - "nonce_expiration_interval": {"key": "nonceExpirationInterval", "type": "str"}, + "min_replicas": {"key": "minReplicas", "type": "int"}, + "max_replicas": {"key": "maxReplicas", "type": "int"}, + "cooldown_period": {"key": "cooldownPeriod", "type": "int"}, + "polling_interval": {"key": "pollingInterval", "type": "int"}, + "rules": {"key": "rules", "type": "[ScaleRule]"}, } def __init__( - self, *, validate_nonce: Optional[bool] = None, nonce_expiration_interval: Optional[str] = None, **kwargs: Any + self, + *, + min_replicas: Optional[int] = None, + max_replicas: int = 10, + cooldown_period: Optional[int] = None, + polling_interval: Optional[int] = None, + rules: Optional[List["_models.ScaleRule"]] = None, + **kwargs: Any ) -> None: """ - :keyword validate_nonce: :code:`false` if the nonce should not be validated while - completing the login flow; otherwise, :code:`true`. - :paramtype validate_nonce: bool - :keyword nonce_expiration_interval: The time after the request is made when the nonce should - expire. - :paramtype nonce_expiration_interval: str + :keyword min_replicas: Optional. Minimum number of container replicas. + :paramtype min_replicas: int + :keyword max_replicas: Optional. Maximum number of container replicas. Defaults to 10 if not + set. + :paramtype max_replicas: int + :keyword cooldown_period: Optional. KEDA Cooldown Period. Defaults to 300 seconds if not set. + :paramtype cooldown_period: int + :keyword polling_interval: Optional. KEDA Polling Interval. Defaults to 30 seconds if not set. + :paramtype polling_interval: int + :keyword rules: Scaling rules. + :paramtype rules: list[~azure.mgmt.appcontainers.models.ScaleRule] """ super().__init__(**kwargs) - self.validate_nonce = validate_nonce - self.nonce_expiration_interval = nonce_expiration_interval + self.min_replicas = min_replicas + self.max_replicas = max_replicas + self.cooldown_period = cooldown_period + self.polling_interval = polling_interval + self.rules = rules -class OpenIdConnectClientCredential(_serialization.Model): - """The authentication client credentials of the custom Open ID Connect provider. +class ScaleConfiguration(_serialization.Model): + """Scale configuration. - :ivar method: The method that should be used to authenticate the user. Default value is - "ClientSecretPost". - :vartype method: str - :ivar client_secret_setting_name: The app setting that contains the client secret for the - custom Open ID Connect provider. - :vartype client_secret_setting_name: str + :ivar max_concurrent_sessions: The maximum count of sessions at the same time. + :vartype max_concurrent_sessions: int + :ivar ready_session_instances: The minimum count of ready session instances. + :vartype ready_session_instances: int """ _attribute_map = { - "method": {"key": "method", "type": "str"}, - "client_secret_setting_name": {"key": "clientSecretSettingName", "type": "str"}, + "max_concurrent_sessions": {"key": "maxConcurrentSessions", "type": "int"}, + "ready_session_instances": {"key": "readySessionInstances", "type": "int"}, } def __init__( self, *, - method: Optional[Literal["ClientSecretPost"]] = None, - client_secret_setting_name: Optional[str] = None, + max_concurrent_sessions: Optional[int] = None, + ready_session_instances: Optional[int] = None, **kwargs: Any ) -> None: """ - :keyword method: The method that should be used to authenticate the user. Default value is - "ClientSecretPost". - :paramtype method: str - :keyword client_secret_setting_name: The app setting that contains the client secret for the - custom Open ID Connect provider. - :paramtype client_secret_setting_name: str + :keyword max_concurrent_sessions: The maximum count of sessions at the same time. + :paramtype max_concurrent_sessions: int + :keyword ready_session_instances: The minimum count of ready session instances. + :paramtype ready_session_instances: int """ super().__init__(**kwargs) - self.method = method - self.client_secret_setting_name = client_secret_setting_name + self.max_concurrent_sessions = max_concurrent_sessions + self.ready_session_instances = ready_session_instances -class OpenIdConnectConfig(_serialization.Model): - """The configuration settings of the endpoints used for the custom Open ID Connect provider. +class ScaleRule(_serialization.Model): + """Container App container scaling rule. - :ivar authorization_endpoint: The endpoint to be used to make an authorization request. - :vartype authorization_endpoint: str - :ivar token_endpoint: The endpoint to be used to request a token. - :vartype token_endpoint: str - :ivar issuer: The endpoint that issues the token. - :vartype issuer: str - :ivar certification_uri: The endpoint that provides the keys necessary to validate the token. - :vartype certification_uri: str - :ivar well_known_open_id_configuration: The endpoint that contains all the configuration - endpoints for the provider. - :vartype well_known_open_id_configuration: str + :ivar name: Scale Rule Name. + :vartype name: str + :ivar azure_queue: Azure Queue based scaling. + :vartype azure_queue: ~azure.mgmt.appcontainers.models.QueueScaleRule + :ivar custom: Custom scale rule. + :vartype custom: ~azure.mgmt.appcontainers.models.CustomScaleRule + :ivar http: HTTP requests based scaling. + :vartype http: ~azure.mgmt.appcontainers.models.HttpScaleRule + :ivar tcp: Tcp requests based scaling. + :vartype tcp: ~azure.mgmt.appcontainers.models.TcpScaleRule """ _attribute_map = { - "authorization_endpoint": {"key": "authorizationEndpoint", "type": "str"}, - "token_endpoint": {"key": "tokenEndpoint", "type": "str"}, - "issuer": {"key": "issuer", "type": "str"}, - "certification_uri": {"key": "certificationUri", "type": "str"}, - "well_known_open_id_configuration": {"key": "wellKnownOpenIdConfiguration", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "azure_queue": {"key": "azureQueue", "type": "QueueScaleRule"}, + "custom": {"key": "custom", "type": "CustomScaleRule"}, + "http": {"key": "http", "type": "HttpScaleRule"}, + "tcp": {"key": "tcp", "type": "TcpScaleRule"}, } def __init__( self, *, - authorization_endpoint: Optional[str] = None, - token_endpoint: Optional[str] = None, - issuer: Optional[str] = None, - certification_uri: Optional[str] = None, - well_known_open_id_configuration: Optional[str] = None, - **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 + name: Optional[str] = None, + azure_queue: Optional["_models.QueueScaleRule"] = None, + custom: Optional["_models.CustomScaleRule"] = None, + http: Optional["_models.HttpScaleRule"] = None, + tcp: Optional["_models.TcpScaleRule"] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: Scale Rule Name. + :paramtype name: str + :keyword azure_queue: Azure Queue based scaling. + :paramtype azure_queue: ~azure.mgmt.appcontainers.models.QueueScaleRule + :keyword custom: Custom scale rule. + :paramtype custom: ~azure.mgmt.appcontainers.models.CustomScaleRule + :keyword http: HTTP requests based scaling. + :paramtype http: ~azure.mgmt.appcontainers.models.HttpScaleRule + :keyword tcp: Tcp requests based scaling. + :paramtype tcp: ~azure.mgmt.appcontainers.models.TcpScaleRule """ super().__init__(**kwargs) - self.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.name = name + self.azure_queue = azure_queue + self.custom = custom + self.http = http + self.tcp = tcp -class OpenIdConnectLogin(_serialization.Model): - """The configuration settings of the login flow of the custom Open ID Connect provider. +class ScaleRuleAuth(_serialization.Model): + """Auth Secrets for Scale Rule. - :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] + :ivar secret_ref: Name of the secret from which to pull the auth params. + :vartype secret_ref: str + :ivar trigger_parameter: Trigger Parameter that uses the secret. + :vartype trigger_parameter: str """ _attribute_map = { - "name_claim_type": {"key": "nameClaimType", "type": "str"}, - "scopes": {"key": "scopes", "type": "[str]"}, + "secret_ref": {"key": "secretRef", "type": "str"}, + "trigger_parameter": {"key": "triggerParameter", "type": "str"}, } def __init__( - self, *, name_claim_type: Optional[str] = None, scopes: Optional[List[str]] = None, **kwargs: Any + self, *, secret_ref: Optional[str] = None, trigger_parameter: Optional[str] = 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 secret_ref: Name of the secret from which to pull the auth params. + :paramtype secret_ref: str + :keyword trigger_parameter: Trigger Parameter that uses the secret. + :paramtype trigger_parameter: str """ super().__init__(**kwargs) - self.name_claim_type = name_claim_type - self.scopes = scopes + self.secret_ref = secret_ref + self.trigger_parameter = trigger_parameter -class OpenIdConnectRegistration(_serialization.Model): - """The configuration settings of the app registration for the custom Open ID Connect provider. +class ScgRoute(_serialization.Model): + """Spring Cloud Gateway route definition. - :ivar client_id: The client id of the custom Open ID Connect provider. - :vartype client_id: str - :ivar client_credential: The authentication credentials of the custom Open ID Connect provider. - :vartype client_credential: ~azure.mgmt.appcontainers.models.OpenIdConnectClientCredential - :ivar open_id_connect_configuration: The configuration settings of the endpoints used for the - custom Open ID Connect provider. - :vartype open_id_connect_configuration: ~azure.mgmt.appcontainers.models.OpenIdConnectConfig + All required parameters must be populated in order to send to server. + + :ivar 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 = { - "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"}, + "uri": {"key": "uri", "type": "str"}, + "predicates": {"key": "predicates", "type": "[str]"}, + "filters": {"key": "filters", "type": "[str]"}, + "order": {"key": "order", "type": "int"}, } def __init__( self, *, - client_id: Optional[str] = None, - client_credential: Optional["_models.OpenIdConnectClientCredential"] = None, - open_id_connect_configuration: Optional["_models.OpenIdConnectConfig"] = None, + 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 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 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.client_id = client_id - self.client_credential = client_credential - self.open_id_connect_configuration = open_id_connect_configuration + self.id = id + self.uri = uri + self.predicates = predicates + self.filters = filters + self.order = order -class OperationDetail(_serialization.Model): - """Operation detail payload. +class Secret(_serialization.Model): + """Secret definition. - :ivar name: Name of the operation. + :ivar name: Secret Name. :vartype name: str - :ivar is_data_action: Indicates whether the operation is a data action. - :vartype is_data_action: bool - :ivar display: Display of the operation. - :vartype display: ~azure.mgmt.appcontainers.models.OperationDisplay - :ivar origin: Origin of the operation. - :vartype origin: str + :ivar value: Secret Value. + :vartype value: str + :ivar identity: Resource ID of a managed identity to authenticate with Azure Key Vault, or + System to use a system-assigned identity. + :vartype identity: str + :ivar key_vault_url: Azure Key Vault URL pointing to the secret referenced by the container + app. + :vartype key_vault_url: str """ _attribute_map = { "name": {"key": "name", "type": "str"}, - "is_data_action": {"key": "isDataAction", "type": "bool"}, - "display": {"key": "display", "type": "OperationDisplay"}, - "origin": {"key": "origin", "type": "str"}, + "value": {"key": "value", "type": "str"}, + "identity": {"key": "identity", "type": "str"}, + "key_vault_url": {"key": "keyVaultUrl", "type": "str"}, } def __init__( self, *, name: Optional[str] = None, - is_data_action: Optional[bool] = None, - display: Optional["_models.OperationDisplay"] = None, - origin: Optional[str] = None, + value: Optional[str] = None, + identity: Optional[str] = None, + key_vault_url: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword name: Name of the operation. + :keyword name: Secret Name. :paramtype name: str - :keyword is_data_action: Indicates whether the operation is a data action. - :paramtype is_data_action: bool - :keyword display: Display of the operation. - :paramtype display: ~azure.mgmt.appcontainers.models.OperationDisplay - :keyword origin: Origin of the operation. - :paramtype origin: str + :keyword value: Secret Value. + :paramtype value: str + :keyword identity: Resource ID of a managed identity to authenticate with Azure Key Vault, or + System to use a system-assigned identity. + :paramtype identity: str + :keyword key_vault_url: Azure Key Vault URL pointing to the secret referenced by the container + app. + :paramtype key_vault_url: str """ super().__init__(**kwargs) self.name = name - self.is_data_action = is_data_action - self.display = display - self.origin = origin + self.value = value + self.identity = identity + self.key_vault_url = key_vault_url -class OperationDisplay(_serialization.Model): - """Operation display payload. +class SecretsCollection(_serialization.Model): + """Container App Secrets Collection ARM resource. - :ivar provider: Resource provider of the operation. - :vartype provider: str - :ivar resource: Resource of the operation. - :vartype resource: str - :ivar operation: Localized friendly name for the operation. - :vartype operation: str - :ivar description: Localized friendly description for the operation. - :vartype description: str + All required parameters must be populated in order to send to server. + + :ivar value: Collection of resources. Required. + :vartype value: list[~azure.mgmt.appcontainers.models.ContainerAppSecret] """ + _validation = { + "value": {"required": True}, + } + _attribute_map = { - "provider": {"key": "provider", "type": "str"}, - "resource": {"key": "resource", "type": "str"}, - "operation": {"key": "operation", "type": "str"}, - "description": {"key": "description", "type": "str"}, + "value": {"key": "value", "type": "[ContainerAppSecret]"}, } - def __init__( - self, - *, - provider: Optional[str] = None, - resource: Optional[str] = None, - operation: Optional[str] = None, - description: Optional[str] = None, - **kwargs: Any - ) -> None: + def __init__(self, *, value: List["_models.ContainerAppSecret"], **kwargs: Any) -> None: """ - :keyword provider: Resource provider of the operation. - :paramtype provider: str - :keyword resource: Resource of the operation. - :paramtype resource: str - :keyword operation: Localized friendly name for the operation. - :paramtype operation: str - :keyword description: Localized friendly description for the operation. - :paramtype description: str + :keyword value: Collection of resources. Required. + :paramtype value: list[~azure.mgmt.appcontainers.models.ContainerAppSecret] """ super().__init__(**kwargs) - self.provider = provider - self.resource = resource - self.operation = operation - self.description = description + self.value = value -class QueueScaleRule(_serialization.Model): - """Container App container Azure Queue based scaling rule. +class SecretVolumeItem(_serialization.Model): + """Secret to be added to volume. - :ivar queue_name: Queue name. - :vartype queue_name: str - :ivar queue_length: Queue length. - :vartype queue_length: int - :ivar auth: Authentication secrets for the queue scale rule. - :vartype auth: list[~azure.mgmt.appcontainers.models.ScaleRuleAuth] + :ivar secret_ref: Name of the Container App secret from which to pull the secret value. + :vartype secret_ref: str + :ivar path: Path to project secret to. If no path is provided, path defaults to name of secret + listed in secretRef. + :vartype path: str """ _attribute_map = { - "queue_name": {"key": "queueName", "type": "str"}, - "queue_length": {"key": "queueLength", "type": "int"}, - "auth": {"key": "auth", "type": "[ScaleRuleAuth]"}, + "secret_ref": {"key": "secretRef", "type": "str"}, + "path": {"key": "path", "type": "str"}, } - def __init__( - self, - *, - queue_name: Optional[str] = None, - queue_length: Optional[int] = None, - auth: Optional[List["_models.ScaleRuleAuth"]] = None, - **kwargs: Any - ) -> None: + def __init__(self, *, secret_ref: Optional[str] = None, path: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword queue_name: Queue name. - :paramtype queue_name: str - :keyword queue_length: Queue length. - :paramtype queue_length: int - :keyword auth: Authentication secrets for the queue scale rule. - :paramtype auth: list[~azure.mgmt.appcontainers.models.ScaleRuleAuth] + :keyword secret_ref: Name of the Container App secret from which to pull the secret value. + :paramtype secret_ref: str + :keyword path: Path to project secret to. If no path is provided, path defaults to name of + secret listed in secretRef. + :paramtype path: str """ super().__init__(**kwargs) - self.queue_name = queue_name - self.queue_length = queue_length - self.auth = auth + self.secret_ref = secret_ref + self.path = path -class RegistryCredentials(_serialization.Model): - """Container App Private Registry. +class Service(_serialization.Model): + """Container App to be a dev service. - :ivar server: Container Registry Server. - :vartype server: str - :ivar username: Container Registry Username. - :vartype username: str - :ivar password_secret_ref: The name of the Secret that contains the registry login password. - :vartype password_secret_ref: str - :ivar identity: A Managed Identity to use to authenticate with Azure Container Registry. For - user-assigned identities, use the full user-assigned identity Resource ID. For system-assigned - identities, use 'system'. - :vartype identity: str + All required parameters must be populated in order to send to server. + + :ivar type: Dev ContainerApp service type. Required. + :vartype type: str """ + _validation = { + "type": {"required": True}, + } + _attribute_map = { - "server": {"key": "server", "type": "str"}, - "username": {"key": "username", "type": "str"}, - "password_secret_ref": {"key": "passwordSecretRef", "type": "str"}, - "identity": {"key": "identity", "type": "str"}, + "type": {"key": "type", "type": "str"}, } - def __init__( - self, - *, - server: Optional[str] = None, - username: Optional[str] = None, - password_secret_ref: Optional[str] = None, - identity: Optional[str] = None, - **kwargs: Any - ) -> None: + def __init__(self, *, type: str, **kwargs: Any) -> None: """ - :keyword server: Container Registry Server. - :paramtype server: str - :keyword username: Container Registry Username. - :paramtype username: str - :keyword password_secret_ref: The name of the Secret that contains the registry login password. - :paramtype password_secret_ref: str - :keyword identity: A Managed Identity to use to authenticate with Azure Container Registry. For - user-assigned identities, use the full user-assigned identity Resource ID. For system-assigned - identities, use 'system'. - :paramtype identity: str + :keyword type: Dev ContainerApp service type. Required. + :paramtype type: str """ super().__init__(**kwargs) - self.server = server - self.username = username - self.password_secret_ref = password_secret_ref - self.identity = identity + self.type = type -class RegistryInfo(_serialization.Model): - """Container App registry information. +class ServiceBind(_serialization.Model): + """Configuration to bind a ContainerApp to a dev ContainerApp Service. - :ivar registry_url: registry server Url. - :vartype registry_url: str - :ivar registry_user_name: registry username. - :vartype registry_user_name: str - :ivar registry_password: registry secret. - :vartype registry_password: str + :ivar service_id: Resource id of the target service. + :vartype service_id: str + :ivar name: Name of the service bind. + :vartype name: str + :ivar client_type: Type of the client to be used to connect to the service. + :vartype client_type: str + :ivar customized_keys: Customized keys for customizing injected values to the app. + :vartype customized_keys: dict[str, str] """ _attribute_map = { - "registry_url": {"key": "registryUrl", "type": "str"}, - "registry_user_name": {"key": "registryUserName", "type": "str"}, - "registry_password": {"key": "registryPassword", "type": "str"}, + "service_id": {"key": "serviceId", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "client_type": {"key": "clientType", "type": "str"}, + "customized_keys": {"key": "customizedKeys", "type": "{str}"}, } def __init__( self, *, - registry_url: Optional[str] = None, - registry_user_name: Optional[str] = None, - registry_password: Optional[str] = None, + service_id: Optional[str] = None, + name: Optional[str] = None, + client_type: Optional[str] = None, + customized_keys: Optional[Dict[str, str]] = None, **kwargs: Any ) -> None: """ - :keyword registry_url: registry server Url. - :paramtype registry_url: str - :keyword registry_user_name: registry username. - :paramtype registry_user_name: str - :keyword registry_password: registry secret. - :paramtype registry_password: str + :keyword service_id: Resource id of the target service. + :paramtype service_id: str + :keyword name: Name of the service bind. + :paramtype name: str + :keyword client_type: Type of the client to be used to connect to the service. + :paramtype client_type: str + :keyword customized_keys: Customized keys for customizing injected values to the app. + :paramtype customized_keys: dict[str, str] """ super().__init__(**kwargs) - self.registry_url = registry_url - self.registry_user_name = registry_user_name - self.registry_password = registry_password - + self.service_id = service_id + self.name = name + self.client_type = client_type + self.customized_keys = customized_keys -class Replica(ProxyResource): - """Container App Revision Replica. - Variables are only populated by the server, and will be ignored when sending a request. +class SessionContainer(_serialization.Model): + """Container definitions for the sessions of the session pool. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. + :ivar image: Container image tag. + :vartype image: str + :ivar name: Custom container name. :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData - :ivar created_time: Timestamp describing when the pod was created by controller. - :vartype created_time: ~datetime.datetime - :ivar running_state: Current running state of the replica. Known values are: "Running", - "NotRunning", and "Unknown". - :vartype running_state: str or ~azure.mgmt.appcontainers.models.ContainerAppReplicaRunningState - :ivar running_state_details: The details of replica current running state. - :vartype running_state_details: str - :ivar containers: The containers collection under a replica. - :vartype containers: list[~azure.mgmt.appcontainers.models.ReplicaContainer] - :ivar init_containers: The init containers collection under a replica. - :vartype init_containers: list[~azure.mgmt.appcontainers.models.ReplicaContainer] + :ivar command: Container start command. + :vartype command: list[str] + :ivar args: Container start command arguments. + :vartype args: list[str] + :ivar env: Container environment variables. + :vartype env: list[~azure.mgmt.appcontainers.models.EnvironmentVar] + :ivar resources: Container resource requirements. + :vartype resources: ~azure.mgmt.appcontainers.models.SessionContainerResources """ - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "created_time": {"readonly": True}, - "running_state": {"readonly": True}, - "running_state_details": {"readonly": True}, - } - _attribute_map = { - "id": {"key": "id", "type": "str"}, + "image": {"key": "image", "type": "str"}, "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "created_time": {"key": "properties.createdTime", "type": "iso-8601"}, - "running_state": {"key": "properties.runningState", "type": "str"}, - "running_state_details": {"key": "properties.runningStateDetails", "type": "str"}, - "containers": {"key": "properties.containers", "type": "[ReplicaContainer]"}, - "init_containers": {"key": "properties.initContainers", "type": "[ReplicaContainer]"}, + "command": {"key": "command", "type": "[str]"}, + "args": {"key": "args", "type": "[str]"}, + "env": {"key": "env", "type": "[EnvironmentVar]"}, + "resources": {"key": "resources", "type": "SessionContainerResources"}, } def __init__( self, *, - containers: Optional[List["_models.ReplicaContainer"]] = None, - init_containers: Optional[List["_models.ReplicaContainer"]] = None, + image: Optional[str] = None, + name: Optional[str] = None, + command: Optional[List[str]] = None, + args: Optional[List[str]] = None, + env: Optional[List["_models.EnvironmentVar"]] = None, + resources: Optional["_models.SessionContainerResources"] = None, **kwargs: Any ) -> None: """ - :keyword containers: The containers collection under a replica. - :paramtype containers: list[~azure.mgmt.appcontainers.models.ReplicaContainer] - :keyword init_containers: The init containers collection under a replica. - :paramtype init_containers: list[~azure.mgmt.appcontainers.models.ReplicaContainer] + :keyword image: Container image tag. + :paramtype image: str + :keyword name: Custom container name. + :paramtype name: str + :keyword command: Container start command. + :paramtype command: list[str] + :keyword args: Container start command arguments. + :paramtype args: list[str] + :keyword env: Container environment variables. + :paramtype env: list[~azure.mgmt.appcontainers.models.EnvironmentVar] + :keyword resources: Container resource requirements. + :paramtype resources: ~azure.mgmt.appcontainers.models.SessionContainerResources """ super().__init__(**kwargs) - self.created_time = None - self.running_state = None - self.running_state_details = None - self.containers = containers - self.init_containers = init_containers - + self.image = image + self.name = name + self.command = command + self.args = args + self.env = env + self.resources = resources -class ReplicaCollection(_serialization.Model): - """Container App Revision Replicas collection ARM resource. - All required parameters must be populated in order to send to server. +class SessionContainerResources(_serialization.Model): + """Container resource requirements for sessions of the session pool. - :ivar value: Collection of resources. Required. - :vartype value: list[~azure.mgmt.appcontainers.models.Replica] + :ivar cpu: Required CPU in cores, e.g. 0.5. + :vartype cpu: float + :ivar memory: Required memory, e.g. "250Mb". + :vartype memory: str """ - _validation = { - "value": {"required": True}, - } - _attribute_map = { - "value": {"key": "value", "type": "[Replica]"}, + "cpu": {"key": "cpu", "type": "float"}, + "memory": {"key": "memory", "type": "str"}, } - def __init__(self, *, value: List["_models.Replica"], **kwargs: Any) -> None: + def __init__(self, *, cpu: Optional[float] = None, memory: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword value: Collection of resources. Required. - :paramtype value: list[~azure.mgmt.appcontainers.models.Replica] + :keyword cpu: Required CPU in cores, e.g. 0.5. + :paramtype cpu: float + :keyword memory: Required memory, e.g. "250Mb". + :paramtype memory: str """ super().__init__(**kwargs) - self.value = value - + self.cpu = cpu + self.memory = memory -class ReplicaContainer(_serialization.Model): - """Container object under Container App Revision Replica. - Variables are only populated by the server, and will be ignored when sending a request. +class SessionIngress(_serialization.Model): + """Session pool ingress configuration. - :ivar name: The Name of the Container. - :vartype name: str - :ivar container_id: The Id of the Container. - :vartype container_id: str - :ivar ready: The container ready status. - :vartype ready: bool - :ivar started: The container start status. - :vartype started: bool - :ivar restart_count: The container restart count. - :vartype restart_count: int - :ivar running_state: Current running state of the container. Known values are: "Running", - "Terminated", and "Waiting". - :vartype running_state: str or - ~azure.mgmt.appcontainers.models.ContainerAppContainerRunningState - :ivar running_state_details: The details of container current running state. - :vartype running_state_details: str - :ivar log_stream_endpoint: Log Stream endpoint. - :vartype log_stream_endpoint: str - :ivar exec_endpoint: Container exec endpoint. - :vartype exec_endpoint: str + :ivar target_port: Target port in containers for traffic from ingress. + :vartype target_port: int """ - _validation = { - "running_state": {"readonly": True}, - "running_state_details": {"readonly": True}, - "log_stream_endpoint": {"readonly": True}, - "exec_endpoint": {"readonly": True}, - } - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "container_id": {"key": "containerId", "type": "str"}, - "ready": {"key": "ready", "type": "bool"}, - "started": {"key": "started", "type": "bool"}, - "restart_count": {"key": "restartCount", "type": "int"}, - "running_state": {"key": "runningState", "type": "str"}, - "running_state_details": {"key": "runningStateDetails", "type": "str"}, - "log_stream_endpoint": {"key": "logStreamEndpoint", "type": "str"}, - "exec_endpoint": {"key": "execEndpoint", "type": "str"}, + "target_port": {"key": "targetPort", "type": "int"}, } - def __init__( - self, - *, - name: Optional[str] = None, - container_id: Optional[str] = None, - ready: Optional[bool] = None, - started: Optional[bool] = None, - restart_count: Optional[int] = None, - **kwargs: Any - ) -> None: + def __init__(self, *, target_port: Optional[int] = None, **kwargs: Any) -> None: + """ + :keyword target_port: Target port in containers for traffic from ingress. + :paramtype target_port: int + """ + super().__init__(**kwargs) + self.target_port = target_port + + +class SessionNetworkConfiguration(_serialization.Model): + """Session network configuration. + + :ivar status: Network status for the sessions. Known values are: "EgressEnabled" and + "EgressDisabled". + :vartype status: str or ~azure.mgmt.appcontainers.models.SessionNetworkStatus + """ + + _attribute_map = { + "status": {"key": "status", "type": "str"}, + } + + def __init__(self, *, status: Optional[Union[str, "_models.SessionNetworkStatus"]] = None, **kwargs: Any) -> None: """ - :keyword name: The Name of the Container. - :paramtype name: str - :keyword container_id: The Id of the Container. - :paramtype container_id: str - :keyword ready: The container ready status. - :paramtype ready: bool - :keyword started: The container start status. - :paramtype started: bool - :keyword restart_count: The container restart count. - :paramtype restart_count: int + :keyword status: Network status for the sessions. Known values are: "EgressEnabled" and + "EgressDisabled". + :paramtype status: str or ~azure.mgmt.appcontainers.models.SessionNetworkStatus """ super().__init__(**kwargs) - self.name = name - self.container_id = container_id - self.ready = ready - self.started = started - self.restart_count = restart_count - self.running_state = None - self.running_state_details = None - self.log_stream_endpoint = None - self.exec_endpoint = None + self.status = status -class Revision(ProxyResource): # pylint: disable=too-many-instance-attributes - """Container App Revision. +class SessionPool(TrackedResource): # pylint: disable=too-many-instance-attributes + """Container App session pool. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + All required parameters must be populated in order to send to server. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -7373,35 +11833,39 @@ class Revision(ProxyResource): # pylint: disable=too-many-instance-attributes :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData - :ivar created_time: Timestamp describing when the revision was created - by controller. - :vartype created_time: ~datetime.datetime - :ivar last_active_time: Timestamp describing when the revision was last active. Only meaningful - when revision is inactive. - :vartype last_active_time: ~datetime.datetime - :ivar fqdn: Fully qualified domain name of the revision. - :vartype fqdn: str - :ivar template: Container App Revision Template with all possible settings and the - defaults if user did not provide them. The defaults are populated - as they were at the creation time. - :vartype template: ~azure.mgmt.appcontainers.models.Template - :ivar active: Boolean describing if the Revision is Active. - :vartype active: bool - :ivar replicas: Number of pods currently running for this revision. - :vartype replicas: int - :ivar traffic_weight: Traffic weight assigned to this revision. - :vartype traffic_weight: int - :ivar provisioning_error: Optional Field - Platform Error Message. - :vartype provisioning_error: str - :ivar health_state: Current health State of the revision. Known values are: "Healthy", - "Unhealthy", and "None". - :vartype health_state: str or ~azure.mgmt.appcontainers.models.RevisionHealthState - :ivar provisioning_state: Current provisioning State of the revision. Known values are: - "Provisioning", "Provisioned", "Failed", "Deprovisioning", and "Deprovisioned". - :vartype provisioning_state: str or ~azure.mgmt.appcontainers.models.RevisionProvisioningState - :ivar running_state: Current running state of the revision. Known values are: "Running", - "Processing", "Stopped", "Degraded", "Failed", and "Unknown". - :vartype running_state: str or ~azure.mgmt.appcontainers.models.RevisionRunningState + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar environment_id: Resource ID of the session pool's environment. + :vartype environment_id: str + :ivar container_type: The container type of the sessions. Known values are: "CustomContainer" + and "PythonLTS". + :vartype container_type: str or ~azure.mgmt.appcontainers.models.ContainerType + :ivar pool_management_type: The pool management type of the session pool. Known values are: + "Manual" and "Dynamic". + :vartype pool_management_type: str or ~azure.mgmt.appcontainers.models.PoolManagementType + :ivar node_count: The number of nodes the session pool is using. + :vartype node_count: int + :ivar scale_configuration: The scale configuration of the session pool. + :vartype scale_configuration: ~azure.mgmt.appcontainers.models.ScaleConfiguration + :ivar secrets: The secrets of the session pool. + :vartype secrets: list[~azure.mgmt.appcontainers.models.SessionPoolSecret] + :ivar dynamic_pool_configuration: The pool configuration if the poolManagementType is dynamic. + :vartype dynamic_pool_configuration: ~azure.mgmt.appcontainers.models.DynamicPoolConfiguration + :ivar custom_container_template: The custom container configuration if the containerType is + CustomContainer. + :vartype custom_container_template: ~azure.mgmt.appcontainers.models.CustomContainerTemplate + :ivar session_network_configuration: The network configuration of the sessions in the session + pool. + :vartype session_network_configuration: + ~azure.mgmt.appcontainers.models.SessionNetworkConfiguration + :ivar pool_management_endpoint: The endpoint to manage the pool. + :vartype pool_management_endpoint: str + :ivar provisioning_state: Provisioning state of the session pool. Known values are: + "InProgress", "Succeeded", "Failed", "Canceled", and "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.appcontainers.models.SessionPoolProvisioningState """ _validation = { @@ -7409,17 +11873,10 @@ class Revision(ProxyResource): # pylint: disable=too-many-instance-attributes "name": {"readonly": True}, "type": {"readonly": True}, "system_data": {"readonly": True}, - "created_time": {"readonly": True}, - "last_active_time": {"readonly": True}, - "fqdn": {"readonly": True}, - "template": {"readonly": True}, - "active": {"readonly": True}, - "replicas": {"readonly": True}, - "traffic_weight": {"readonly": True}, - "provisioning_error": {"readonly": True}, - "health_state": {"readonly": True}, + "location": {"required": True}, + "node_count": {"readonly": True}, + "pool_management_endpoint": {"readonly": True}, "provisioning_state": {"readonly": True}, - "running_state": {"readonly": True}, } _attribute_map = { @@ -7427,44 +11884,94 @@ class Revision(ProxyResource): # pylint: disable=too-many-instance-attributes "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, "system_data": {"key": "systemData", "type": "SystemData"}, - "created_time": {"key": "properties.createdTime", "type": "iso-8601"}, - "last_active_time": {"key": "properties.lastActiveTime", "type": "iso-8601"}, - "fqdn": {"key": "properties.fqdn", "type": "str"}, - "template": {"key": "properties.template", "type": "Template"}, - "active": {"key": "properties.active", "type": "bool"}, - "replicas": {"key": "properties.replicas", "type": "int"}, - "traffic_weight": {"key": "properties.trafficWeight", "type": "int"}, - "provisioning_error": {"key": "properties.provisioningError", "type": "str"}, - "health_state": {"key": "properties.healthState", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "environment_id": {"key": "properties.environmentId", "type": "str"}, + "container_type": {"key": "properties.containerType", "type": "str"}, + "pool_management_type": {"key": "properties.poolManagementType", "type": "str"}, + "node_count": {"key": "properties.nodeCount", "type": "int"}, + "scale_configuration": {"key": "properties.scaleConfiguration", "type": "ScaleConfiguration"}, + "secrets": {"key": "properties.secrets", "type": "[SessionPoolSecret]"}, + "dynamic_pool_configuration": { + "key": "properties.dynamicPoolConfiguration", + "type": "DynamicPoolConfiguration", + }, + "custom_container_template": {"key": "properties.customContainerTemplate", "type": "CustomContainerTemplate"}, + "session_network_configuration": { + "key": "properties.sessionNetworkConfiguration", + "type": "SessionNetworkConfiguration", + }, + "pool_management_endpoint": {"key": "properties.poolManagementEndpoint", "type": "str"}, "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "running_state": {"key": "properties.runningState", "type": "str"}, } - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.created_time = None - self.last_active_time = None - self.fqdn = None - self.template = None - self.active = None - self.replicas = None - self.traffic_weight = None - self.provisioning_error = None - self.health_state = None + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + environment_id: Optional[str] = None, + container_type: Optional[Union[str, "_models.ContainerType"]] = None, + pool_management_type: Optional[Union[str, "_models.PoolManagementType"]] = None, + scale_configuration: Optional["_models.ScaleConfiguration"] = None, + secrets: Optional[List["_models.SessionPoolSecret"]] = None, + dynamic_pool_configuration: Optional["_models.DynamicPoolConfiguration"] = None, + custom_container_template: Optional["_models.CustomContainerTemplate"] = None, + session_network_configuration: Optional["_models.SessionNetworkConfiguration"] = None, + **kwargs: Any + ) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str + :keyword environment_id: Resource ID of the session pool's environment. + :paramtype environment_id: str + :keyword container_type: The container type of the sessions. Known values are: + "CustomContainer" and "PythonLTS". + :paramtype container_type: str or ~azure.mgmt.appcontainers.models.ContainerType + :keyword pool_management_type: The pool management type of the session pool. Known values are: + "Manual" and "Dynamic". + :paramtype pool_management_type: str or ~azure.mgmt.appcontainers.models.PoolManagementType + :keyword scale_configuration: The scale configuration of the session pool. + :paramtype scale_configuration: ~azure.mgmt.appcontainers.models.ScaleConfiguration + :keyword secrets: The secrets of the session pool. + :paramtype secrets: list[~azure.mgmt.appcontainers.models.SessionPoolSecret] + :keyword dynamic_pool_configuration: The pool configuration if the poolManagementType is + dynamic. + :paramtype dynamic_pool_configuration: + ~azure.mgmt.appcontainers.models.DynamicPoolConfiguration + :keyword custom_container_template: The custom container configuration if the containerType is + CustomContainer. + :paramtype custom_container_template: ~azure.mgmt.appcontainers.models.CustomContainerTemplate + :keyword session_network_configuration: The network configuration of the sessions in the + session pool. + :paramtype session_network_configuration: + ~azure.mgmt.appcontainers.models.SessionNetworkConfiguration + """ + super().__init__(tags=tags, location=location, **kwargs) + self.environment_id = environment_id + self.container_type = container_type + self.pool_management_type = pool_management_type + self.node_count = None + self.scale_configuration = scale_configuration + self.secrets = secrets + self.dynamic_pool_configuration = dynamic_pool_configuration + self.custom_container_template = custom_container_template + self.session_network_configuration = session_network_configuration + self.pool_management_endpoint = None self.provisioning_state = None - self.running_state = None -class RevisionCollection(_serialization.Model): - """Container App Revisions collection ARM resource. +class SessionPoolCollection(_serialization.Model): + """Session pool collection Azure resource. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to server. :ivar value: Collection of resources. Required. - :vartype value: list[~azure.mgmt.appcontainers.models.Revision] + :vartype value: list[~azure.mgmt.appcontainers.models.SessionPool] :ivar next_link: Link to next page of resources. :vartype next_link: str """ @@ -7475,408 +11982,590 @@ class RevisionCollection(_serialization.Model): } _attribute_map = { - "value": {"key": "value", "type": "[Revision]"}, + "value": {"key": "value", "type": "[SessionPool]"}, "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: List["_models.Revision"], **kwargs: Any) -> None: + def __init__(self, *, value: List["_models.SessionPool"], **kwargs: Any) -> None: """ :keyword value: Collection of resources. Required. - :paramtype value: list[~azure.mgmt.appcontainers.models.Revision] + :paramtype value: list[~azure.mgmt.appcontainers.models.SessionPool] """ super().__init__(**kwargs) self.value = value self.next_link = None -class Scale(_serialization.Model): - """Container App scaling configurations. +class SessionPoolSecret(_serialization.Model): + """Secret definition. - :ivar min_replicas: Optional. Minimum number of container replicas. - :vartype min_replicas: int - :ivar max_replicas: Optional. Maximum number of container replicas. Defaults to 10 if not set. - :vartype max_replicas: int - :ivar rules: Scaling rules. - :vartype rules: list[~azure.mgmt.appcontainers.models.ScaleRule] + :ivar name: Secret Name. + :vartype name: str + :ivar value: Secret Value. + :vartype value: str """ _attribute_map = { - "min_replicas": {"key": "minReplicas", "type": "int"}, - "max_replicas": {"key": "maxReplicas", "type": "int"}, - "rules": {"key": "rules", "type": "[ScaleRule]"}, + "name": {"key": "name", "type": "str"}, + "value": {"key": "value", "type": "str"}, + } + + def __init__(self, *, name: Optional[str] = None, value: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword name: Secret Name. + :paramtype name: str + :keyword value: Secret Value. + :paramtype value: str + """ + super().__init__(**kwargs) + self.name = name + self.value = value + + +class SessionPoolUpdatableProperties(_serialization.Model): + """Container App session pool updatable properties. + + :ivar scale_configuration: The scale configuration of the session pool. + :vartype scale_configuration: ~azure.mgmt.appcontainers.models.ScaleConfiguration + :ivar secrets: The secrets of the session pool. + :vartype secrets: list[~azure.mgmt.appcontainers.models.SessionPoolSecret] + :ivar dynamic_pool_configuration: The pool configuration if the poolManagementType is dynamic. + :vartype dynamic_pool_configuration: ~azure.mgmt.appcontainers.models.DynamicPoolConfiguration + :ivar custom_container_template: The custom container configuration if the containerType is + CustomContainer. + :vartype custom_container_template: ~azure.mgmt.appcontainers.models.CustomContainerTemplate + :ivar session_network_configuration: The network configuration of the sessions in the session + pool. + :vartype session_network_configuration: + ~azure.mgmt.appcontainers.models.SessionNetworkConfiguration + """ + + _attribute_map = { + "scale_configuration": {"key": "properties.scaleConfiguration", "type": "ScaleConfiguration"}, + "secrets": {"key": "properties.secrets", "type": "[SessionPoolSecret]"}, + "dynamic_pool_configuration": { + "key": "properties.dynamicPoolConfiguration", + "type": "DynamicPoolConfiguration", + }, + "custom_container_template": {"key": "properties.customContainerTemplate", "type": "CustomContainerTemplate"}, + "session_network_configuration": { + "key": "properties.sessionNetworkConfiguration", + "type": "SessionNetworkConfiguration", + }, } def __init__( self, *, - min_replicas: Optional[int] = None, - max_replicas: int = 10, - rules: Optional[List["_models.ScaleRule"]] = None, + scale_configuration: Optional["_models.ScaleConfiguration"] = None, + secrets: Optional[List["_models.SessionPoolSecret"]] = None, + dynamic_pool_configuration: Optional["_models.DynamicPoolConfiguration"] = None, + custom_container_template: Optional["_models.CustomContainerTemplate"] = None, + session_network_configuration: Optional["_models.SessionNetworkConfiguration"] = None, **kwargs: Any ) -> None: """ - :keyword min_replicas: Optional. Minimum number of container replicas. - :paramtype min_replicas: int - :keyword max_replicas: Optional. Maximum number of container replicas. Defaults to 10 if not - set. - :paramtype max_replicas: int - :keyword rules: Scaling rules. - :paramtype rules: list[~azure.mgmt.appcontainers.models.ScaleRule] - """ - super().__init__(**kwargs) - self.min_replicas = min_replicas - self.max_replicas = max_replicas - self.rules = rules + :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.scale_configuration = scale_configuration + self.secrets = secrets + self.dynamic_pool_configuration = dynamic_pool_configuration + self.custom_container_template = custom_container_template + self.session_network_configuration = session_network_configuration -class ScaleRule(_serialization.Model): - """Container App container scaling rule. +class SessionRegistryCredentials(_serialization.Model): + """Session pool private registry credentials. - :ivar name: Scale Rule Name. - :vartype name: str - :ivar azure_queue: Azure Queue based scaling. - :vartype azure_queue: ~azure.mgmt.appcontainers.models.QueueScaleRule - :ivar custom: Custom scale rule. - :vartype custom: ~azure.mgmt.appcontainers.models.CustomScaleRule - :ivar http: HTTP requests based scaling. - :vartype http: ~azure.mgmt.appcontainers.models.HttpScaleRule - :ivar tcp: Tcp requests based scaling. - :vartype tcp: ~azure.mgmt.appcontainers.models.TcpScaleRule + :ivar server: Container registry server. + :vartype server: str + :ivar username: Container registry username. + :vartype username: str + :ivar password_secret_ref: The name of the secret that contains the registry login password. + :vartype password_secret_ref: str + :ivar identity: A Managed Identity to use to authenticate with Azure Container Registry. For + user-assigned identities, use the full user-assigned identity Resource ID. For system-assigned + identities, use 'system'. + :vartype identity: str """ _attribute_map = { - "name": {"key": "name", "type": "str"}, - "azure_queue": {"key": "azureQueue", "type": "QueueScaleRule"}, - "custom": {"key": "custom", "type": "CustomScaleRule"}, - "http": {"key": "http", "type": "HttpScaleRule"}, - "tcp": {"key": "tcp", "type": "TcpScaleRule"}, + "server": {"key": "server", "type": "str"}, + "username": {"key": "username", "type": "str"}, + "password_secret_ref": {"key": "passwordSecretRef", "type": "str"}, + "identity": {"key": "identity", "type": "str"}, } def __init__( self, *, - name: Optional[str] = None, - azure_queue: Optional["_models.QueueScaleRule"] = None, - custom: Optional["_models.CustomScaleRule"] = None, - http: Optional["_models.HttpScaleRule"] = None, - tcp: Optional["_models.TcpScaleRule"] = None, + server: Optional[str] = None, + username: Optional[str] = None, + password_secret_ref: Optional[str] = None, + identity: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword name: Scale Rule Name. - :paramtype name: str - :keyword azure_queue: Azure Queue based scaling. - :paramtype azure_queue: ~azure.mgmt.appcontainers.models.QueueScaleRule - :keyword custom: Custom scale rule. - :paramtype custom: ~azure.mgmt.appcontainers.models.CustomScaleRule - :keyword http: HTTP requests based scaling. - :paramtype http: ~azure.mgmt.appcontainers.models.HttpScaleRule - :keyword tcp: Tcp requests based scaling. - :paramtype tcp: ~azure.mgmt.appcontainers.models.TcpScaleRule + :keyword server: Container registry server. + :paramtype server: str + :keyword username: Container registry username. + :paramtype username: str + :keyword password_secret_ref: The name of the secret that contains the registry login password. + :paramtype password_secret_ref: str + :keyword identity: A Managed Identity to use to authenticate with Azure Container Registry. For + user-assigned identities, use the full user-assigned identity Resource ID. For system-assigned + identities, use 'system'. + :paramtype identity: str """ super().__init__(**kwargs) - self.name = name - self.azure_queue = azure_queue - self.custom = custom - self.http = http - self.tcp = tcp + self.server = server + self.username = username + self.password_secret_ref = password_secret_ref + self.identity = identity -class ScaleRuleAuth(_serialization.Model): - """Auth Secrets for Scale Rule. +class SmbStorage(_serialization.Model): + """SMB storage properties. - :ivar secret_ref: Name of the secret from which to pull the auth params. - :vartype secret_ref: str - :ivar trigger_parameter: Trigger Parameter that uses the secret. - :vartype trigger_parameter: str + :ivar host: The host name or IP address of the SMB server. + :vartype host: str + :ivar share_name: The path to the SMB shared folder. + :vartype share_name: str + :ivar username: The user to log on to the SMB server. + :vartype username: str + :ivar domain: The domain name for the user. + :vartype domain: str + :ivar password: The password for the user. + :vartype password: str + :ivar access_mode: Access mode for storage. Known values are: "ReadOnly" and "ReadWrite". + :vartype access_mode: str or ~azure.mgmt.appcontainers.models.AccessMode """ _attribute_map = { - "secret_ref": {"key": "secretRef", "type": "str"}, - "trigger_parameter": {"key": "triggerParameter", "type": "str"}, + "host": {"key": "host", "type": "str"}, + "share_name": {"key": "shareName", "type": "str"}, + "username": {"key": "username", "type": "str"}, + "domain": {"key": "domain", "type": "str"}, + "password": {"key": "password", "type": "str"}, + "access_mode": {"key": "accessMode", "type": "str"}, } def __init__( - self, *, secret_ref: Optional[str] = None, trigger_parameter: Optional[str] = None, **kwargs: Any + self, + *, + host: Optional[str] = None, + share_name: Optional[str] = None, + username: Optional[str] = None, + domain: Optional[str] = None, + password: Optional[str] = None, + access_mode: Optional[Union[str, "_models.AccessMode"]] = None, + **kwargs: Any ) -> None: """ - :keyword secret_ref: Name of the secret from which to pull the auth params. - :paramtype secret_ref: str - :keyword trigger_parameter: Trigger Parameter that uses the secret. - :paramtype trigger_parameter: str + :keyword host: The host name or IP address of the SMB server. + :paramtype host: str + :keyword share_name: The path to the SMB shared folder. + :paramtype share_name: str + :keyword username: The user to log on to the SMB server. + :paramtype username: str + :keyword domain: The domain name for the user. + :paramtype domain: str + :keyword password: The password for the user. + :paramtype password: str + :keyword access_mode: Access mode for storage. Known values are: "ReadOnly" and "ReadWrite". + :paramtype access_mode: str or ~azure.mgmt.appcontainers.models.AccessMode """ super().__init__(**kwargs) - self.secret_ref = secret_ref - self.trigger_parameter = trigger_parameter + self.host = host + self.share_name = share_name + self.username = username + self.domain = domain + self.password = password + self.access_mode = access_mode -class Secret(_serialization.Model): - """Secret definition. +class SourceControl(ProxyResource): + """Container App SourceControl. - :ivar name: Secret Name. + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. :vartype name: str - :ivar value: Secret Value. - :vartype value: str - :ivar identity: Resource ID of a managed identity to authenticate with Azure Key Vault, or - System to use a system-assigned identity. - :vartype identity: str - :ivar key_vault_url: Azure Key Vault URL pointing to the secret referenced by the container - app. - :vartype key_vault_url: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData + :ivar operation_state: Current provisioning State of the operation. Known values are: + "InProgress", "Succeeded", "Failed", and "Canceled". + :vartype operation_state: str or ~azure.mgmt.appcontainers.models.SourceControlOperationState + :ivar repo_url: The repo url which will be integrated to ContainerApp. + :vartype repo_url: str + :ivar branch: The branch which will trigger the auto deployment. + :vartype branch: str + :ivar github_action_configuration: Container App Revision Template with all possible settings + and the + defaults if user did not provide them. The defaults are populated + as they were at the creation time. + :vartype github_action_configuration: + ~azure.mgmt.appcontainers.models.GithubActionConfiguration """ + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "operation_state": {"readonly": True}, + } + _attribute_map = { + "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, - "value": {"key": "value", "type": "str"}, - "identity": {"key": "identity", "type": "str"}, - "key_vault_url": {"key": "keyVaultUrl", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "operation_state": {"key": "properties.operationState", "type": "str"}, + "repo_url": {"key": "properties.repoUrl", "type": "str"}, + "branch": {"key": "properties.branch", "type": "str"}, + "github_action_configuration": { + "key": "properties.githubActionConfiguration", + "type": "GithubActionConfiguration", + }, } def __init__( self, *, - name: Optional[str] = None, - value: Optional[str] = None, - identity: Optional[str] = None, - key_vault_url: Optional[str] = None, + repo_url: Optional[str] = None, + branch: Optional[str] = None, + github_action_configuration: Optional["_models.GithubActionConfiguration"] = None, **kwargs: Any ) -> None: """ - :keyword name: Secret Name. - :paramtype name: str - :keyword value: Secret Value. - :paramtype value: str - :keyword identity: Resource ID of a managed identity to authenticate with Azure Key Vault, or - System to use a system-assigned identity. - :paramtype identity: str - :keyword key_vault_url: Azure Key Vault URL pointing to the secret referenced by the container - app. - :paramtype key_vault_url: str + :keyword repo_url: The repo url which will be integrated to ContainerApp. + :paramtype repo_url: str + :keyword branch: The branch which will trigger the auto deployment. + :paramtype branch: str + :keyword github_action_configuration: Container App Revision Template with all possible + settings and the + defaults if user did not provide them. The defaults are populated + as they were at the creation time. + :paramtype github_action_configuration: + ~azure.mgmt.appcontainers.models.GithubActionConfiguration """ super().__init__(**kwargs) - self.name = name - self.value = value - self.identity = identity - self.key_vault_url = key_vault_url + self.operation_state = None + self.repo_url = repo_url + self.branch = branch + self.github_action_configuration = github_action_configuration -class SecretsCollection(_serialization.Model): - """Container App Secrets Collection ARM resource. +class SourceControlCollection(_serialization.Model): + """SourceControl collection ARM resource. + + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to server. :ivar value: Collection of resources. Required. - :vartype value: list[~azure.mgmt.appcontainers.models.ContainerAppSecret] + :vartype value: list[~azure.mgmt.appcontainers.models.SourceControl] + :ivar next_link: Link to next page of resources. + :vartype next_link: str """ _validation = { "value": {"required": True}, + "next_link": {"readonly": True}, } _attribute_map = { - "value": {"key": "value", "type": "[ContainerAppSecret]"}, + "value": {"key": "value", "type": "[SourceControl]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: List["_models.ContainerAppSecret"], **kwargs: Any) -> None: + def __init__(self, *, value: List["_models.SourceControl"], **kwargs: Any) -> None: """ :keyword value: Collection of resources. Required. - :paramtype value: list[~azure.mgmt.appcontainers.models.ContainerAppSecret] + :paramtype value: list[~azure.mgmt.appcontainers.models.SourceControl] """ super().__init__(**kwargs) self.value = value + self.next_link = None -class SecretVolumeItem(_serialization.Model): - """Secret to be added to volume. - - :ivar secret_ref: Name of the Container App secret from which to pull the secret value. - :vartype secret_ref: str - :ivar path: Path to project secret to. If no path is provided, path defaults to name of secret - listed in secretRef. - :vartype path: str - """ - - _attribute_map = { - "secret_ref": {"key": "secretRef", "type": "str"}, - "path": {"key": "path", "type": "str"}, - } - - def __init__(self, *, secret_ref: Optional[str] = None, path: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword secret_ref: Name of the Container App secret from which to pull the secret value. - :paramtype secret_ref: str - :keyword path: Path to project secret to. If no path is provided, path defaults to name of - secret listed in secretRef. - :paramtype path: str - """ - super().__init__(**kwargs) - self.secret_ref = secret_ref - self.path = path - +class SpringBootAdminComponent(JavaComponentProperties): + """Spring Boot Admin properties. -class Service(_serialization.Model): - """Container App to be a dev service. + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to server. - :ivar type: Dev ContainerApp service type. Required. - :vartype type: str + :ivar component_type: Type of the Java Component. Required. Known values are: + "SpringBootAdmin", "SpringCloudEureka", "SpringCloudConfig", "SpringCloudGateway", and "Nacos". + :vartype component_type: str or ~azure.mgmt.appcontainers.models.JavaComponentType + :ivar provisioning_state: Provisioning state of the Java Component. Known values are: + "Succeeded", "Failed", "Canceled", "Deleting", and "InProgress". + :vartype provisioning_state: str or + ~azure.mgmt.appcontainers.models.JavaComponentProvisioningState + :ivar configurations: List of Java Components configuration properties. + :vartype configurations: + list[~azure.mgmt.appcontainers.models.JavaComponentConfigurationProperty] + :ivar scale: Java component scaling configurations. + :vartype scale: ~azure.mgmt.appcontainers.models.JavaComponentPropertiesScale + :ivar service_binds: List of Java Components that are bound to the Java component. + :vartype service_binds: list[~azure.mgmt.appcontainers.models.JavaComponentServiceBind] + :ivar ingress: Java Component Ingress configurations. + :vartype ingress: ~azure.mgmt.appcontainers.models.JavaComponentIngress """ _validation = { - "type": {"required": True}, + "component_type": {"required": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - "type": {"key": "type", "type": "str"}, + "component_type": {"key": "componentType", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "configurations": {"key": "configurations", "type": "[JavaComponentConfigurationProperty]"}, + "scale": {"key": "scale", "type": "JavaComponentPropertiesScale"}, + "service_binds": {"key": "serviceBinds", "type": "[JavaComponentServiceBind]"}, + "ingress": {"key": "ingress", "type": "JavaComponentIngress"}, } - def __init__(self, *, type: str, **kwargs: Any) -> None: - """ - :keyword type: Dev ContainerApp service type. Required. - :paramtype type: str + def __init__( + self, + *, + configurations: Optional[List["_models.JavaComponentConfigurationProperty"]] = None, + scale: Optional["_models.JavaComponentPropertiesScale"] = None, + service_binds: Optional[List["_models.JavaComponentServiceBind"]] = None, + ingress: Optional["_models.JavaComponentIngress"] = None, + **kwargs: Any + ) -> None: """ - super().__init__(**kwargs) - self.type = type + :keyword configurations: List of Java Components configuration properties. + :paramtype configurations: + list[~azure.mgmt.appcontainers.models.JavaComponentConfigurationProperty] + :keyword scale: Java component scaling configurations. + :paramtype scale: ~azure.mgmt.appcontainers.models.JavaComponentPropertiesScale + :keyword service_binds: List of Java Components that are bound to the Java component. + :paramtype service_binds: list[~azure.mgmt.appcontainers.models.JavaComponentServiceBind] + :keyword ingress: Java Component Ingress configurations. + :paramtype ingress: ~azure.mgmt.appcontainers.models.JavaComponentIngress + """ + super().__init__(configurations=configurations, scale=scale, service_binds=service_binds, **kwargs) + self.component_type: str = "SpringBootAdmin" + self.ingress = ingress -class ServiceBind(_serialization.Model): - """Configuration to bind a ContainerApp to a dev ContainerApp Service. +class SpringCloudConfigComponent(JavaComponentProperties): + """Spring Cloud Config properties. - :ivar service_id: Resource id of the target service. - :vartype service_id: str - :ivar name: Name of the service bind. - :vartype name: str + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar component_type: Type of the Java Component. Required. Known values are: + "SpringBootAdmin", "SpringCloudEureka", "SpringCloudConfig", "SpringCloudGateway", and "Nacos". + :vartype component_type: str or ~azure.mgmt.appcontainers.models.JavaComponentType + :ivar provisioning_state: Provisioning state of the Java Component. Known values are: + "Succeeded", "Failed", "Canceled", "Deleting", and "InProgress". + :vartype provisioning_state: str or + ~azure.mgmt.appcontainers.models.JavaComponentProvisioningState + :ivar configurations: List of Java Components configuration properties. + :vartype configurations: + list[~azure.mgmt.appcontainers.models.JavaComponentConfigurationProperty] + :ivar scale: Java component scaling configurations. + :vartype scale: ~azure.mgmt.appcontainers.models.JavaComponentPropertiesScale + :ivar service_binds: List of Java Components that are bound to the Java component. + :vartype service_binds: list[~azure.mgmt.appcontainers.models.JavaComponentServiceBind] """ + _validation = { + "component_type": {"required": True}, + "provisioning_state": {"readonly": True}, + } + _attribute_map = { - "service_id": {"key": "serviceId", "type": "str"}, - "name": {"key": "name", "type": "str"}, + "component_type": {"key": "componentType", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "configurations": {"key": "configurations", "type": "[JavaComponentConfigurationProperty]"}, + "scale": {"key": "scale", "type": "JavaComponentPropertiesScale"}, + "service_binds": {"key": "serviceBinds", "type": "[JavaComponentServiceBind]"}, } - def __init__(self, *, service_id: Optional[str] = None, name: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword service_id: Resource id of the target service. - :paramtype service_id: str - :keyword name: Name of the service bind. - :paramtype name: str + def __init__( + self, + *, + configurations: Optional[List["_models.JavaComponentConfigurationProperty"]] = None, + scale: Optional["_models.JavaComponentPropertiesScale"] = None, + service_binds: Optional[List["_models.JavaComponentServiceBind"]] = None, + **kwargs: Any + ) -> None: """ - super().__init__(**kwargs) - self.service_id = service_id - self.name = name - - -class SourceControl(ProxyResource): - """Container App SourceControl. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData - :ivar operation_state: Current provisioning State of the operation. Known values are: - "InProgress", "Succeeded", "Failed", and "Canceled". - :vartype operation_state: str or ~azure.mgmt.appcontainers.models.SourceControlOperationState - :ivar repo_url: The repo url which will be integrated to ContainerApp. - :vartype repo_url: str - :ivar branch: The branch which will trigger the auto deployment. - :vartype branch: str - :ivar github_action_configuration: Container App Revision Template with all possible settings - and the - defaults if user did not provide them. The defaults are populated - as they were at the creation time. - :vartype github_action_configuration: - ~azure.mgmt.appcontainers.models.GithubActionConfiguration + :keyword configurations: List of Java Components configuration properties. + :paramtype configurations: + list[~azure.mgmt.appcontainers.models.JavaComponentConfigurationProperty] + :keyword scale: Java component scaling configurations. + :paramtype scale: ~azure.mgmt.appcontainers.models.JavaComponentPropertiesScale + :keyword service_binds: List of Java Components that are bound to the Java component. + :paramtype service_binds: list[~azure.mgmt.appcontainers.models.JavaComponentServiceBind] + """ + super().__init__(configurations=configurations, scale=scale, service_binds=service_binds, **kwargs) + self.component_type: str = "SpringCloudConfig" + + +class SpringCloudEurekaComponent(JavaComponentProperties): + """Spring Cloud Eureka properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar component_type: Type of the Java Component. Required. Known values are: + "SpringBootAdmin", "SpringCloudEureka", "SpringCloudConfig", "SpringCloudGateway", and "Nacos". + :vartype component_type: str or ~azure.mgmt.appcontainers.models.JavaComponentType + :ivar provisioning_state: Provisioning state of the Java Component. Known values are: + "Succeeded", "Failed", "Canceled", "Deleting", and "InProgress". + :vartype provisioning_state: str or + ~azure.mgmt.appcontainers.models.JavaComponentProvisioningState + :ivar configurations: List of Java Components configuration properties. + :vartype configurations: + list[~azure.mgmt.appcontainers.models.JavaComponentConfigurationProperty] + :ivar scale: Java component scaling configurations. + :vartype scale: ~azure.mgmt.appcontainers.models.JavaComponentPropertiesScale + :ivar service_binds: List of Java Components that are bound to the Java component. + :vartype service_binds: list[~azure.mgmt.appcontainers.models.JavaComponentServiceBind] + :ivar ingress: Java Component Ingress configurations. + :vartype ingress: ~azure.mgmt.appcontainers.models.JavaComponentIngress """ _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "operation_state": {"readonly": True}, + "component_type": {"required": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "operation_state": {"key": "properties.operationState", "type": "str"}, - "repo_url": {"key": "properties.repoUrl", "type": "str"}, - "branch": {"key": "properties.branch", "type": "str"}, - "github_action_configuration": { - "key": "properties.githubActionConfiguration", - "type": "GithubActionConfiguration", - }, + "component_type": {"key": "componentType", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "configurations": {"key": "configurations", "type": "[JavaComponentConfigurationProperty]"}, + "scale": {"key": "scale", "type": "JavaComponentPropertiesScale"}, + "service_binds": {"key": "serviceBinds", "type": "[JavaComponentServiceBind]"}, + "ingress": {"key": "ingress", "type": "JavaComponentIngress"}, } def __init__( self, *, - repo_url: Optional[str] = None, - branch: Optional[str] = None, - github_action_configuration: Optional["_models.GithubActionConfiguration"] = None, + configurations: Optional[List["_models.JavaComponentConfigurationProperty"]] = None, + scale: Optional["_models.JavaComponentPropertiesScale"] = None, + service_binds: Optional[List["_models.JavaComponentServiceBind"]] = None, + ingress: Optional["_models.JavaComponentIngress"] = None, **kwargs: Any ) -> None: """ - :keyword repo_url: The repo url which will be integrated to ContainerApp. - :paramtype repo_url: str - :keyword branch: The branch which will trigger the auto deployment. - :paramtype branch: str - :keyword github_action_configuration: Container App Revision Template with all possible - settings and the - defaults if user did not provide them. The defaults are populated - as they were at the creation time. - :paramtype github_action_configuration: - ~azure.mgmt.appcontainers.models.GithubActionConfiguration - """ - super().__init__(**kwargs) - self.operation_state = None - self.repo_url = repo_url - self.branch = branch - self.github_action_configuration = github_action_configuration + :keyword configurations: List of Java Components configuration properties. + :paramtype configurations: + list[~azure.mgmt.appcontainers.models.JavaComponentConfigurationProperty] + :keyword scale: Java component scaling configurations. + :paramtype scale: ~azure.mgmt.appcontainers.models.JavaComponentPropertiesScale + :keyword service_binds: List of Java Components that are bound to the Java component. + :paramtype service_binds: list[~azure.mgmt.appcontainers.models.JavaComponentServiceBind] + :keyword ingress: Java Component Ingress configurations. + :paramtype ingress: ~azure.mgmt.appcontainers.models.JavaComponentIngress + """ + super().__init__(configurations=configurations, scale=scale, service_binds=service_binds, **kwargs) + self.component_type: str = "SpringCloudEureka" + self.ingress = ingress -class SourceControlCollection(_serialization.Model): - """SourceControl collection ARM resource. +class SpringCloudGatewayComponent(JavaComponentProperties): + """Spring Cloud Gateway properties. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to server. - :ivar value: Collection of resources. Required. - :vartype value: list[~azure.mgmt.appcontainers.models.SourceControl] - :ivar next_link: Link to next page of resources. - :vartype next_link: str + :ivar component_type: Type of the Java Component. Required. Known values are: + "SpringBootAdmin", "SpringCloudEureka", "SpringCloudConfig", "SpringCloudGateway", and "Nacos". + :vartype component_type: str or ~azure.mgmt.appcontainers.models.JavaComponentType + :ivar provisioning_state: Provisioning state of the Java Component. Known values are: + "Succeeded", "Failed", "Canceled", "Deleting", and "InProgress". + :vartype provisioning_state: str or + ~azure.mgmt.appcontainers.models.JavaComponentProvisioningState + :ivar configurations: List of Java Components configuration properties. + :vartype configurations: + list[~azure.mgmt.appcontainers.models.JavaComponentConfigurationProperty] + :ivar scale: Java component scaling configurations. + :vartype scale: ~azure.mgmt.appcontainers.models.JavaComponentPropertiesScale + :ivar service_binds: List of Java Components that are bound to the Java component. + :vartype service_binds: list[~azure.mgmt.appcontainers.models.JavaComponentServiceBind] + :ivar ingress: Java Component Ingress configurations. + :vartype ingress: ~azure.mgmt.appcontainers.models.JavaComponentIngress + :ivar spring_cloud_gateway_routes: Gateway route definition. + :vartype spring_cloud_gateway_routes: list[~azure.mgmt.appcontainers.models.ScgRoute] """ _validation = { - "value": {"required": True}, - "next_link": {"readonly": True}, + "component_type": {"required": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - "value": {"key": "value", "type": "[SourceControl]"}, - "next_link": {"key": "nextLink", "type": "str"}, + "component_type": {"key": "componentType", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "configurations": {"key": "configurations", "type": "[JavaComponentConfigurationProperty]"}, + "scale": {"key": "scale", "type": "JavaComponentPropertiesScale"}, + "service_binds": {"key": "serviceBinds", "type": "[JavaComponentServiceBind]"}, + "ingress": {"key": "ingress", "type": "JavaComponentIngress"}, + "spring_cloud_gateway_routes": {"key": "springCloudGatewayRoutes", "type": "[ScgRoute]"}, } - def __init__(self, *, value: List["_models.SourceControl"], **kwargs: Any) -> None: - """ - :keyword value: Collection of resources. Required. - :paramtype value: list[~azure.mgmt.appcontainers.models.SourceControl] + def __init__( + self, + *, + configurations: Optional[List["_models.JavaComponentConfigurationProperty"]] = None, + scale: Optional["_models.JavaComponentPropertiesScale"] = None, + service_binds: Optional[List["_models.JavaComponentServiceBind"]] = None, + ingress: Optional["_models.JavaComponentIngress"] = None, + spring_cloud_gateway_routes: Optional[List["_models.ScgRoute"]] = None, + **kwargs: Any + ) -> None: """ - super().__init__(**kwargs) - self.value = value - self.next_link = None + :keyword configurations: List of Java Components configuration properties. + :paramtype configurations: + list[~azure.mgmt.appcontainers.models.JavaComponentConfigurationProperty] + :keyword scale: Java component scaling configurations. + :paramtype scale: ~azure.mgmt.appcontainers.models.JavaComponentPropertiesScale + :keyword service_binds: List of Java Components that are bound to the Java component. + :paramtype service_binds: list[~azure.mgmt.appcontainers.models.JavaComponentServiceBind] + :keyword ingress: Java Component Ingress configurations. + :paramtype ingress: ~azure.mgmt.appcontainers.models.JavaComponentIngress + :keyword spring_cloud_gateway_routes: Gateway route definition. + :paramtype spring_cloud_gateway_routes: list[~azure.mgmt.appcontainers.models.ScgRoute] + """ + super().__init__(configurations=configurations, scale=scale, service_binds=service_binds, **kwargs) + self.component_type: str = "SpringCloudGateway" + self.ingress = ingress + self.spring_cloud_gateway_routes = spring_cloud_gateway_routes class SystemData(_serialization.Model): @@ -7943,6 +12632,46 @@ def __init__( self.last_modified_at = last_modified_at +class TcpConnectionPool(_serialization.Model): + """Defines parameters for tcp connection pooling. + + :ivar max_connections: Maximum number of tcp connections allowed. + :vartype max_connections: int + """ + + _attribute_map = { + "max_connections": {"key": "maxConnections", "type": "int"}, + } + + def __init__(self, *, max_connections: Optional[int] = None, **kwargs: Any) -> None: + """ + :keyword max_connections: Maximum number of tcp connections allowed. + :paramtype max_connections: int + """ + super().__init__(**kwargs) + self.max_connections = max_connections + + +class TcpRetryPolicy(_serialization.Model): + """Policy that defines tcp request retry conditions. + + :ivar max_connect_attempts: Maximum number of attempts to connect to the tcp service. + :vartype max_connect_attempts: int + """ + + _attribute_map = { + "max_connect_attempts": {"key": "maxConnectAttempts", "type": "int"}, + } + + def __init__(self, *, max_connect_attempts: Optional[int] = None, **kwargs: Any) -> None: + """ + :keyword max_connect_attempts: Maximum number of attempts to connect to the tcp service. + :paramtype max_connect_attempts: int + """ + super().__init__(**kwargs) + self.max_connect_attempts = max_connect_attempts + + class TcpScaleRule(_serialization.Model): """Container App container Tcp scaling rule. @@ -7950,11 +12679,15 @@ class TcpScaleRule(_serialization.Model): :vartype metadata: dict[str, str] :ivar auth: Authentication secrets for the tcp scale rule. :vartype auth: list[~azure.mgmt.appcontainers.models.ScaleRuleAuth] + :ivar identity: The resource ID of a user-assigned managed identity that is assigned to the + Container App, or 'system' for system-assigned identity. + :vartype identity: str """ _attribute_map = { "metadata": {"key": "metadata", "type": "{str}"}, "auth": {"key": "auth", "type": "[ScaleRuleAuth]"}, + "identity": {"key": "identity", "type": "str"}, } def __init__( @@ -7962,6 +12695,7 @@ def __init__( *, metadata: Optional[Dict[str, str]] = None, auth: Optional[List["_models.ScaleRuleAuth"]] = None, + identity: Optional[str] = None, **kwargs: Any ) -> None: """ @@ -7969,10 +12703,14 @@ def __init__( :paramtype metadata: dict[str, str] :keyword auth: Authentication secrets for the tcp scale rule. :paramtype auth: list[~azure.mgmt.appcontainers.models.ScaleRuleAuth] + :keyword identity: The resource ID of a user-assigned managed identity that is assigned to the + Container App, or 'system' for system-assigned identity. + :paramtype identity: str """ super().__init__(**kwargs) self.metadata = metadata self.auth = auth + self.identity = identity class Template(_serialization.Model): @@ -8052,6 +12790,40 @@ def __init__( self.service_binds = service_binds +class TimeoutPolicy(_serialization.Model): + """Policy to set request timeouts. + + :ivar response_timeout_in_seconds: Timeout, in seconds, for a request to respond. + :vartype response_timeout_in_seconds: int + :ivar connection_timeout_in_seconds: Timeout, in seconds, for a request to initiate a + connection. + :vartype connection_timeout_in_seconds: int + """ + + _attribute_map = { + "response_timeout_in_seconds": {"key": "responseTimeoutInSeconds", "type": "int"}, + "connection_timeout_in_seconds": {"key": "connectionTimeoutInSeconds", "type": "int"}, + } + + def __init__( + self, + *, + response_timeout_in_seconds: Optional[int] = None, + connection_timeout_in_seconds: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword response_timeout_in_seconds: Timeout, in seconds, for a request to respond. + :paramtype response_timeout_in_seconds: int + :keyword connection_timeout_in_seconds: Timeout, in seconds, for a request to initiate a + connection. + :paramtype connection_timeout_in_seconds: int + """ + super().__init__(**kwargs) + self.response_timeout_in_seconds = response_timeout_in_seconds + self.connection_timeout_in_seconds = connection_timeout_in_seconds + + class TokenStore(_serialization.Model): """The configuration settings of the token store. @@ -8101,6 +12873,34 @@ def __init__( self.azure_blob_storage = azure_blob_storage +class TracesConfiguration(_serialization.Model): + """Configuration of Open Telemetry traces. + + :ivar include_dapr: Boolean indicating if including dapr traces. + :vartype include_dapr: bool + :ivar destinations: Open telemetry traces destinations. + :vartype destinations: list[str] + """ + + _attribute_map = { + "include_dapr": {"key": "includeDapr", "type": "bool"}, + "destinations": {"key": "destinations", "type": "[str]"}, + } + + def __init__( + self, *, include_dapr: Optional[bool] = None, destinations: Optional[List[str]] = None, **kwargs: Any + ) -> None: + """ + :keyword include_dapr: Boolean indicating if including dapr traces. + :paramtype include_dapr: bool + :keyword destinations: Open telemetry traces destinations. + :paramtype destinations: list[str] + """ + super().__init__(**kwargs) + self.include_dapr = include_dapr + self.destinations = destinations + + class TrafficWeight(_serialization.Model): """Traffic weight assigned to a revision. @@ -8394,15 +13194,15 @@ class Volume(_serialization.Model): :ivar name: Volume name. :vartype name: str :ivar storage_type: Storage type for the volume. If not provided, use EmptyDir. Known values - are: "AzureFile", "EmptyDir", and "Secret". + are: "AzureFile", "EmptyDir", "Secret", "NfsAzureFile", and "Smb". :vartype storage_type: str or ~azure.mgmt.appcontainers.models.StorageType :ivar storage_name: Name of storage resource. No need to provide for EmptyDir and Secret. :vartype storage_name: str :ivar secrets: List of secrets to be added in volume. If no secrets are provided, all secrets in collection will be added to volume. :vartype secrets: list[~azure.mgmt.appcontainers.models.SecretVolumeItem] - :ivar mount_options: Mount options used while mounting the AzureFile. Must be a comma-separated - string. + :ivar mount_options: Mount options used while mounting the Azure file share or NFS Azure file + share. Must be a comma-separated string. :vartype mount_options: str """ @@ -8428,15 +13228,15 @@ def __init__( :keyword name: Volume name. :paramtype name: str :keyword storage_type: Storage type for the volume. If not provided, use EmptyDir. Known values - are: "AzureFile", "EmptyDir", and "Secret". + are: "AzureFile", "EmptyDir", "Secret", "NfsAzureFile", and "Smb". :paramtype storage_type: str or ~azure.mgmt.appcontainers.models.StorageType :keyword storage_name: Name of storage resource. No need to provide for EmptyDir and Secret. :paramtype storage_name: str :keyword secrets: List of secrets to be added in volume. If no secrets are provided, all secrets in collection will be added to volume. :paramtype secrets: list[~azure.mgmt.appcontainers.models.SecretVolumeItem] - :keyword mount_options: Mount options used while mounting the AzureFile. Must be a - comma-separated string. + :keyword mount_options: Mount options used while mounting the Azure file share or NFS Azure + file share. Must be a comma-separated string. :paramtype mount_options: str """ super().__init__(**kwargs) @@ -8490,6 +13290,218 @@ def __init__( self.sub_path = sub_path +class WorkflowArtifacts(_serialization.Model): + """The workflow filter. + + :ivar app_settings: Application settings of the workflow. + :vartype app_settings: JSON + :ivar files: Files of the app. + :vartype files: JSON + :ivar files_to_delete: Files of the app to delete. + :vartype files_to_delete: list[str] + """ + + _attribute_map = { + "app_settings": {"key": "appSettings", "type": "object"}, + "files": {"key": "files", "type": "object"}, + "files_to_delete": {"key": "filesToDelete", "type": "[str]"}, + } + + def __init__( + self, + *, + app_settings: Optional[JSON] = None, + files: Optional[JSON] = None, + files_to_delete: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword app_settings: Application settings of the workflow. + :paramtype app_settings: JSON + :keyword files: Files of the app. + :paramtype files: JSON + :keyword files_to_delete: Files of the app to delete. + :paramtype files_to_delete: list[str] + """ + super().__init__(**kwargs) + self.app_settings = app_settings + self.files = files + self.files_to_delete = files_to_delete + + +class WorkflowEnvelope(_serialization.Model): + """Workflow properties definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The resource id. + :vartype id: str + :ivar name: Gets the resource name. + :vartype name: str + :ivar type: Gets the resource type. + :vartype type: str + :ivar kind: The resource kind. + :vartype kind: str + :ivar location: The resource location. + :vartype location: str + :ivar properties: Additional workflow properties. + :vartype properties: ~azure.mgmt.appcontainers.models.WorkflowEnvelopeProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "kind": {"key": "kind", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "properties": {"key": "properties", "type": "WorkflowEnvelopeProperties"}, + } + + def __init__( + self, + *, + kind: Optional[str] = None, + location: Optional[str] = None, + properties: Optional["_models.WorkflowEnvelopeProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword kind: The resource kind. + :paramtype kind: str + :keyword location: The resource location. + :paramtype location: str + :keyword properties: Additional workflow properties. + :paramtype properties: ~azure.mgmt.appcontainers.models.WorkflowEnvelopeProperties + """ + super().__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.kind = kind + self.location = location + self.properties = properties + + +class WorkflowEnvelopeCollection(_serialization.Model): + """Collection of workflow information elements. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar value: Collection of resources. Required. + :vartype value: list[~azure.mgmt.appcontainers.models.WorkflowEnvelope] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[WorkflowEnvelope]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.WorkflowEnvelope"], **kwargs: Any) -> None: + """ + :keyword value: Collection of resources. Required. + :paramtype value: list[~azure.mgmt.appcontainers.models.WorkflowEnvelope] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class WorkflowEnvelopeProperties(_serialization.Model): + """Additional workflow properties. + + :ivar files: Gets or sets the files. + :vartype files: JSON + :ivar flow_state: Gets or sets the state of the workflow. Known values are: "NotSpecified", + "Completed", "Enabled", "Disabled", "Deleted", and "Suspended". + :vartype flow_state: str or ~azure.mgmt.appcontainers.models.WorkflowState + :ivar health: Gets or sets workflow health. + :vartype health: ~azure.mgmt.appcontainers.models.WorkflowHealth + """ + + _attribute_map = { + "files": {"key": "files", "type": "object"}, + "flow_state": {"key": "flowState", "type": "str"}, + "health": {"key": "health", "type": "WorkflowHealth"}, + } + + def __init__( + self, + *, + files: Optional[JSON] = None, + flow_state: Optional[Union[str, "_models.WorkflowState"]] = None, + health: Optional["_models.WorkflowHealth"] = None, + **kwargs: Any + ) -> None: + """ + :keyword files: Gets or sets the files. + :paramtype files: JSON + :keyword flow_state: Gets or sets the state of the workflow. Known values are: "NotSpecified", + "Completed", "Enabled", "Disabled", "Deleted", and "Suspended". + :paramtype flow_state: str or ~azure.mgmt.appcontainers.models.WorkflowState + :keyword health: Gets or sets workflow health. + :paramtype health: ~azure.mgmt.appcontainers.models.WorkflowHealth + """ + super().__init__(**kwargs) + self.files = files + self.flow_state = flow_state + self.health = health + + +class WorkflowHealth(_serialization.Model): + """Represents the workflow health. + + All required parameters must be populated in order to send to server. + + :ivar state: Gets or sets the workflow health state. Required. Known values are: + "NotSpecified", "Healthy", "Unhealthy", and "Unknown". + :vartype state: str or ~azure.mgmt.appcontainers.models.WorkflowHealthState + :ivar error: Gets or sets the workflow error. + :vartype error: ~azure.mgmt.appcontainers.models.ErrorEntity + """ + + _validation = { + "state": {"required": True}, + } + + _attribute_map = { + "state": {"key": "state", "type": "str"}, + "error": {"key": "error", "type": "ErrorEntity"}, + } + + def __init__( + self, + *, + state: Union[str, "_models.WorkflowHealthState"], + error: Optional["_models.ErrorEntity"] = None, + **kwargs: Any + ) -> None: + """ + :keyword state: Gets or sets the workflow health state. Required. Known values are: + "NotSpecified", "Healthy", "Unhealthy", and "Unknown". + :paramtype state: str or ~azure.mgmt.appcontainers.models.WorkflowHealthState + :keyword error: Gets or sets the workflow error. + :paramtype error: ~azure.mgmt.appcontainers.models.ErrorEntity + """ + super().__init__(**kwargs) + self.state = state + self.error = error + + class WorkloadProfile(_serialization.Model): """Workload profile to scope container app execution. @@ -8497,6 +13509,9 @@ class WorkloadProfile(_serialization.Model): :ivar name: Workload profile type for the workloads to run on. Required. :vartype name: str + :ivar enable_fips: Whether to use a FIPS-enabled OS. Supported only for dedicated workload + profiles. + :vartype enable_fips: bool :ivar workload_profile_type: Workload profile type for the workloads to run on. Required. :vartype workload_profile_type: str :ivar minimum_count: The minimum capacity. @@ -8512,6 +13527,7 @@ class WorkloadProfile(_serialization.Model): _attribute_map = { "name": {"key": "name", "type": "str"}, + "enable_fips": {"key": "enableFips", "type": "bool"}, "workload_profile_type": {"key": "workloadProfileType", "type": "str"}, "minimum_count": {"key": "minimumCount", "type": "int"}, "maximum_count": {"key": "maximumCount", "type": "int"}, @@ -8522,6 +13538,7 @@ def __init__( *, name: str, workload_profile_type: str, + enable_fips: bool = False, minimum_count: Optional[int] = None, maximum_count: Optional[int] = None, **kwargs: Any @@ -8529,6 +13546,9 @@ def __init__( """ :keyword name: Workload profile type for the workloads to run on. Required. :paramtype name: str + :keyword enable_fips: Whether to use a FIPS-enabled OS. Supported only for dedicated workload + profiles. + :paramtype enable_fips: bool :keyword workload_profile_type: Workload profile type for the workloads to run on. Required. :paramtype workload_profile_type: str :keyword minimum_count: The minimum capacity. @@ -8538,6 +13558,7 @@ def __init__( """ super().__init__(**kwargs) self.name = name + self.enable_fips = enable_fips self.workload_profile_type = workload_profile_type self.minimum_count = minimum_count self.maximum_count = maximum_count @@ -8548,8 +13569,8 @@ class WorkloadProfileStates(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/__init__.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/__init__.py index 1d1af7c18205..f105aaf0a686 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/__init__.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/__init__.py @@ -6,29 +6,48 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from ._app_resiliency_operations import AppResiliencyOperations from ._container_apps_auth_configs_operations import ContainerAppsAuthConfigsOperations from ._available_workload_profiles_operations import AvailableWorkloadProfilesOperations from ._billing_meters_operations import BillingMetersOperations +from ._builders_operations import BuildersOperations +from ._builds_by_builder_resource_operations import BuildsByBuilderResourceOperations +from ._builds_operations import BuildsOperations +from ._build_auth_token_operations import BuildAuthTokenOperations from ._connected_environments_operations import ConnectedEnvironmentsOperations from ._connected_environments_certificates_operations import ConnectedEnvironmentsCertificatesOperations from ._connected_environments_dapr_components_operations import ConnectedEnvironmentsDaprComponentsOperations from ._connected_environments_storages_operations import ConnectedEnvironmentsStoragesOperations from ._container_apps_operations import ContainerAppsOperations +from ._container_apps_builds_by_container_app_operations import ContainerAppsBuildsByContainerAppOperations +from ._container_apps_builds_operations import ContainerAppsBuildsOperations +from ._container_apps_patches_operations import ContainerAppsPatchesOperations from ._container_apps_revisions_operations import ContainerAppsRevisionsOperations from ._container_apps_revision_replicas_operations import ContainerAppsRevisionReplicasOperations from ._container_apps_diagnostics_operations import ContainerAppsDiagnosticsOperations from ._managed_environment_diagnostics_operations import ManagedEnvironmentDiagnosticsOperations from ._managed_environments_diagnostics_operations import ManagedEnvironmentsDiagnosticsOperations from ._jobs_operations import JobsOperations +from ._dot_net_components_operations import DotNetComponentsOperations +from ._functions_extension_operations import FunctionsExtensionOperations from ._operations import Operations +from ._java_components_operations import JavaComponentsOperations from ._jobs_executions_operations import JobsExecutionsOperations from ._container_apps_api_client_operations import ContainerAppsAPIClientOperationsMixin +from ._logic_apps_operations import LogicAppsOperations from ._managed_environments_operations import ManagedEnvironmentsOperations from ._certificates_operations import CertificatesOperations from ._managed_certificates_operations import ManagedCertificatesOperations from ._namespaces_operations import NamespacesOperations +from ._managed_environment_private_endpoint_connections_operations import ( + ManagedEnvironmentPrivateEndpointConnectionsOperations, +) +from ._managed_environment_private_link_resources_operations import ManagedEnvironmentPrivateLinkResourcesOperations +from ._dapr_component_resiliency_policies_operations import DaprComponentResiliencyPoliciesOperations from ._dapr_components_operations import DaprComponentsOperations +from ._dapr_subscriptions_operations import DaprSubscriptionsOperations from ._managed_environments_storages_operations import ManagedEnvironmentsStoragesOperations +from ._container_apps_session_pools_operations import ContainerAppsSessionPoolsOperations from ._container_apps_source_controls_operations import ContainerAppsSourceControlsOperations from ._usages_operations import UsagesOperations from ._managed_environment_usages_operations import ManagedEnvironmentUsagesOperations @@ -38,29 +57,46 @@ from ._patch import patch_sdk as _patch_sdk __all__ = [ + "AppResiliencyOperations", "ContainerAppsAuthConfigsOperations", "AvailableWorkloadProfilesOperations", "BillingMetersOperations", + "BuildersOperations", + "BuildsByBuilderResourceOperations", + "BuildsOperations", + "BuildAuthTokenOperations", "ConnectedEnvironmentsOperations", "ConnectedEnvironmentsCertificatesOperations", "ConnectedEnvironmentsDaprComponentsOperations", "ConnectedEnvironmentsStoragesOperations", "ContainerAppsOperations", + "ContainerAppsBuildsByContainerAppOperations", + "ContainerAppsBuildsOperations", + "ContainerAppsPatchesOperations", "ContainerAppsRevisionsOperations", "ContainerAppsRevisionReplicasOperations", "ContainerAppsDiagnosticsOperations", "ManagedEnvironmentDiagnosticsOperations", "ManagedEnvironmentsDiagnosticsOperations", "JobsOperations", + "DotNetComponentsOperations", + "FunctionsExtensionOperations", "Operations", + "JavaComponentsOperations", "JobsExecutionsOperations", "ContainerAppsAPIClientOperationsMixin", + "LogicAppsOperations", "ManagedEnvironmentsOperations", "CertificatesOperations", "ManagedCertificatesOperations", "NamespacesOperations", + "ManagedEnvironmentPrivateEndpointConnectionsOperations", + "ManagedEnvironmentPrivateLinkResourcesOperations", + "DaprComponentResiliencyPoliciesOperations", "DaprComponentsOperations", + "DaprSubscriptionsOperations", "ManagedEnvironmentsStoragesOperations", + "ContainerAppsSessionPoolsOperations", "ContainerAppsSourceControlsOperations", "UsagesOperations", "ManagedEnvironmentUsagesOperations", 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..007ffc990766 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_app_resiliency_operations.py @@ -0,0 +1,731 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_create_or_update_request( + resource_group_name: str, app_name: str, name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{appName}/resiliencyPolicies/{name}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "appName": _SERIALIZER.url("app_name", app_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "name": _SERIALIZER.url("name", name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request( + resource_group_name: str, app_name: str, name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{appName}/resiliencyPolicies/{name}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "appName": _SERIALIZER.url("app_name", app_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "name": _SERIALIZER.url("name", name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, app_name: str, name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{appName}/resiliencyPolicies/{name}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "appName": _SERIALIZER.url("app_name", app_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "name": _SERIALIZER.url("name", name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, app_name: str, name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{appName}/resiliencyPolicies/{name}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "appName": _SERIALIZER.url("app_name", app_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "name": _SERIALIZER.url("name", name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_request(resource_group_name: str, app_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{appName}/resiliencyPolicies", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "appName": _SERIALIZER.url("app_name", app_name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class AppResiliencyOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s + :attr:`app_resiliency` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @overload + def create_or_update( + self, + resource_group_name: str, + app_name: str, + name: str, + resiliency_envelope: _models.AppResiliency, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AppResiliency: + """Create or update an application's resiliency policy. + + Create or update container app resiliency policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_name: Name of the Container App. Required. + :type app_name: str + :param name: Name of the resiliency policy. Required. + :type name: str + :param resiliency_envelope: The resiliency policy to create or update. Required. + :type resiliency_envelope: ~azure.mgmt.appcontainers.models.AppResiliency + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: AppResiliency or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.AppResiliency + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + app_name: str, + name: str, + resiliency_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AppResiliency: + """Create or update an application's resiliency policy. + + Create or update container app resiliency policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_name: Name of the Container App. Required. + :type app_name: str + :param name: Name of the resiliency policy. Required. + :type name: str + :param resiliency_envelope: The resiliency policy to create or update. Required. + :type resiliency_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: AppResiliency or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.AppResiliency + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + app_name: str, + name: str, + resiliency_envelope: Union[_models.AppResiliency, IO[bytes]], + **kwargs: Any + ) -> _models.AppResiliency: + """Create or update an application's resiliency policy. + + Create or update container app resiliency policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_name: Name of the Container App. Required. + :type app_name: str + :param name: Name of the resiliency policy. Required. + :type name: str + :param resiliency_envelope: The resiliency policy to create or update. Is either a + AppResiliency type or a IO[bytes] type. Required. + :type resiliency_envelope: ~azure.mgmt.appcontainers.models.AppResiliency or IO[bytes] + :return: AppResiliency or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.AppResiliency + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AppResiliency] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(resiliency_envelope, (IOBase, bytes)): + _content = resiliency_envelope + else: + _json = self._serialize.body(resiliency_envelope, "AppResiliency") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + app_name=app_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AppResiliency", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def update( + self, + resource_group_name: str, + app_name: str, + name: str, + resiliency_envelope: _models.AppResiliency, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AppResiliency: + """Update an application's resiliency policy. + + Update container app resiliency policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_name: Name of the Container App. Required. + :type app_name: str + :param name: Name of the resiliency policy. Required. + :type name: str + :param resiliency_envelope: The resiliency policy to update. Required. + :type resiliency_envelope: ~azure.mgmt.appcontainers.models.AppResiliency + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: AppResiliency or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.AppResiliency + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + app_name: str, + name: str, + resiliency_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AppResiliency: + """Update an application's resiliency policy. + + Update container app resiliency policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_name: Name of the Container App. Required. + :type app_name: str + :param name: Name of the resiliency policy. Required. + :type name: str + :param resiliency_envelope: The resiliency policy to update. Required. + :type resiliency_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: AppResiliency or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.AppResiliency + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + app_name: str, + name: str, + resiliency_envelope: Union[_models.AppResiliency, IO[bytes]], + **kwargs: Any + ) -> _models.AppResiliency: + """Update an application's resiliency policy. + + Update container app resiliency policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_name: Name of the Container App. Required. + :type app_name: str + :param name: Name of the resiliency policy. Required. + :type name: str + :param resiliency_envelope: The resiliency policy to update. Is either a AppResiliency type or + a IO[bytes] type. Required. + :type resiliency_envelope: ~azure.mgmt.appcontainers.models.AppResiliency or IO[bytes] + :return: AppResiliency or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.AppResiliency + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AppResiliency] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(resiliency_envelope, (IOBase, bytes)): + _content = resiliency_envelope + else: + _json = self._serialize.body(resiliency_envelope, "AppResiliency") + + _request = build_update_request( + resource_group_name=resource_group_name, + app_name=app_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AppResiliency", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, app_name: str, name: str, **kwargs: Any + ) -> None: + """Delete an application's resiliency policy. + + Delete container app resiliency policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_name: Name of the Container App. Required. + :type app_name: str + :param name: Name of the resiliency policy. Required. + :type name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + app_name=app_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def get(self, resource_group_name: str, app_name: str, name: str, **kwargs: Any) -> _models.AppResiliency: + """Get an application's resiliency policy. + + Get container app resiliency policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_name: Name of the Container App. Required. + :type app_name: str + :param name: Name of the resiliency policy. Required. + :type name: str + :return: AppResiliency or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.AppResiliency + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AppResiliency] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + app_name=app_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AppResiliency", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list(self, resource_group_name: str, app_name: str, **kwargs: Any) -> Iterable["_models.AppResiliency"]: + """List an application's resiliency policies. + + List container app resiliency policies. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_name: Name of the Container App. Required. + :type app_name: str + :return: An iterator like instance of either AppResiliency or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.AppResiliency] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AppResiliencyCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + app_name=app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("AppResiliencyCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_available_workload_profiles_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_available_workload_profiles_operations.py index 8c26ddeffe62..2e759340e8f8 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_available_workload_profiles_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_available_workload_profiles_operations.py @@ -27,7 +27,6 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -44,7 +43,7 @@ def build_get_request(location: str, subscription_id: str, **kwargs: Any) -> Htt _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -53,7 +52,7 @@ def build_get_request(location: str, subscription_id: str, **kwargs: Any) -> Htt "/subscriptions/{subscriptionId}/providers/Microsoft.App/locations/{location}/availableManagedEnvironmentsWorkloadProfileTypes", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "location": _SERIALIZER.url("location", location, "str", min_length=1), } diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_billing_meters_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_billing_meters_operations.py index 531d90d1e903..8f64d6ac5a55 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_billing_meters_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_billing_meters_operations.py @@ -25,7 +25,6 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -42,7 +41,7 @@ def build_get_request(location: str, subscription_id: str, **kwargs: Any) -> Htt _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -50,7 +49,7 @@ def build_get_request(location: str, subscription_id: str, **kwargs: Any) -> Htt "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.App/locations/{location}/billingMeters" ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "location": _SERIALIZER.url("location", location, "str", min_length=1), } diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_build_auth_token_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_build_auth_token_operations.py new file mode 100644 index 000000000000..ba1910fd2d62 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_build_auth_token_operations.py @@ -0,0 +1,154 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_request( + resource_group_name: str, builder_name: str, build_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}/builds/{buildName}/listAuthToken", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "builderName": _SERIALIZER.url( + "builder_name", builder_name, "str", max_length=32, min_length=2, pattern=r"^[-\w\._\(\)]+$" + ), + "buildName": _SERIALIZER.url( + "build_name", build_name, "str", max_length=64, min_length=2, pattern=r"^[-\w\._\(\)]+$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class BuildAuthTokenOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s + :attr:`build_auth_token` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list(self, resource_group_name: str, builder_name: str, build_name: str, **kwargs: Any) -> _models.BuildToken: + """Gets the token used to connect to the endpoint where source code can be uploaded for a build. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param build_name: The name of a build. Required. + :type build_name: str + :return: BuildToken or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.BuildToken + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BuildToken] = kwargs.pop("cls", None) + + _request = build_list_request( + resource_group_name=resource_group_name, + builder_name=builder_name, + build_name=build_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("BuildToken", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_builders_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_builders_operations.py new file mode 100644 index 000000000000..186330f36bbd --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_builders_operations.py @@ -0,0 +1,980 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.App/builders") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request(resource_group_name: str, builder_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "builderName": _SERIALIZER.url( + "builder_name", builder_name, "str", max_length=32, min_length=2, pattern=r"^[-\w\._\(\)]+$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, builder_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "builderName": _SERIALIZER.url( + "builder_name", builder_name, "str", max_length=32, min_length=2, pattern=r"^[-\w\._\(\)]+$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request( + resource_group_name: str, builder_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "builderName": _SERIALIZER.url( + "builder_name", builder_name, "str", max_length=32, min_length=2, pattern=r"^[-\w\._\(\)]+$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, builder_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "builderName": _SERIALIZER.url( + "builder_name", builder_name, "str", max_length=32, min_length=2, pattern=r"^[-\w\._\(\)]+$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class BuildersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s + :attr:`builders` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.BuilderResource"]: + """List BuilderResource resources by subscription ID. + + :return: An iterator like instance of either BuilderResource or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.BuilderResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BuilderCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("BuilderCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.BuilderResource"]: + """List BuilderResource resources by resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of either BuilderResource or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.BuilderResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BuilderCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("BuilderCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get(self, resource_group_name: str, builder_name: str, **kwargs: Any) -> _models.BuilderResource: + """Get a BuilderResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :return: BuilderResource or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.BuilderResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + builder_name=builder_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("BuilderResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + builder_name: str, + builder_envelope: Union[_models.BuilderResource, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(builder_envelope, (IOBase, bytes)): + _content = builder_envelope + else: + _json = self._serialize.body(builder_envelope, "BuilderResource") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + builder_name=builder_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + builder_name: str, + builder_envelope: _models.BuilderResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.BuilderResource]: + """Create or update a BuilderResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param builder_envelope: Resource create parameters. Required. + :type builder_envelope: ~azure.mgmt.appcontainers.models.BuilderResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either BuilderResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.BuilderResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + builder_name: str, + builder_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.BuilderResource]: + """Create or update a BuilderResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param builder_envelope: Resource create parameters. Required. + :type builder_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either BuilderResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.BuilderResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + builder_name: str, + builder_envelope: Union[_models.BuilderResource, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.BuilderResource]: + """Create or update a BuilderResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param builder_envelope: Resource create parameters. Is either a BuilderResource type or a + IO[bytes] type. Required. + :type builder_envelope: ~azure.mgmt.appcontainers.models.BuilderResource or IO[bytes] + :return: An instance of LROPoller that returns either BuilderResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.BuilderResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + builder_name=builder_name, + builder_envelope=builder_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("BuilderResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.BuilderResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.BuilderResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _update_initial( + self, + resource_group_name: str, + builder_name: str, + builder_envelope: Union[_models.BuilderResourceUpdate, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(builder_envelope, (IOBase, bytes)): + _content = builder_envelope + else: + _json = self._serialize.body(builder_envelope, "BuilderResourceUpdate") + + _request = build_update_request( + resource_group_name=resource_group_name, + builder_name=builder_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + builder_name: str, + builder_envelope: _models.BuilderResourceUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.BuilderResource]: + """Update a BuilderResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param builder_envelope: The resource properties to be updated. Required. + :type builder_envelope: ~azure.mgmt.appcontainers.models.BuilderResourceUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either BuilderResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.BuilderResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + builder_name: str, + builder_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.BuilderResource]: + """Update a BuilderResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param builder_envelope: The resource properties to be updated. Required. + :type builder_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either BuilderResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.BuilderResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + builder_name: str, + builder_envelope: Union[_models.BuilderResourceUpdate, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.BuilderResource]: + """Update a BuilderResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param builder_envelope: The resource properties to be updated. Is either a + BuilderResourceUpdate type or a IO[bytes] type. Required. + :type builder_envelope: ~azure.mgmt.appcontainers.models.BuilderResourceUpdate or IO[bytes] + :return: An instance of LROPoller that returns either BuilderResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.BuilderResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + builder_name=builder_name, + builder_envelope=builder_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("BuilderResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.BuilderResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.BuilderResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial(self, resource_group_name: str, builder_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + builder_name=builder_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete(self, resource_group_name: str, builder_name: str, **kwargs: Any) -> LROPoller[None]: + """Delete a BuilderResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + builder_name=builder_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_builds_by_builder_resource_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_builds_by_builder_resource_operations.py new file mode 100644 index 000000000000..8aa6f68d3d89 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_builds_by_builder_resource_operations.py @@ -0,0 +1,174 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_request(resource_group_name: str, builder_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}/builds", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "builderName": _SERIALIZER.url( + "builder_name", builder_name, "str", max_length=32, min_length=2, pattern=r"^[-\w\._\(\)]+$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class BuildsByBuilderResourceOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s + :attr:`builds_by_builder_resource` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list(self, resource_group_name: str, builder_name: str, **kwargs: Any) -> Iterable["_models.BuildResource"]: + """List BuildResource resources by BuilderResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :return: An iterator like instance of either BuildResource or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.BuildResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BuildCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + builder_name=builder_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("BuildCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_builds_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_builds_operations.py new file mode 100644 index 000000000000..bcc1f199cf5e --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_builds_operations.py @@ -0,0 +1,567 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterator, Optional, Type, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_get_request( + resource_group_name: str, builder_name: str, build_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}/builds/{buildName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "builderName": _SERIALIZER.url( + "builder_name", builder_name, "str", max_length=32, min_length=2, pattern=r"^[-\w\._\(\)]+$" + ), + "buildName": _SERIALIZER.url( + "build_name", build_name, "str", max_length=64, min_length=2, pattern=r"^[-\w\._\(\)]+$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, builder_name: str, build_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}/builds/{buildName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "builderName": _SERIALIZER.url( + "builder_name", builder_name, "str", max_length=32, min_length=2, pattern=r"^[-\w\._\(\)]+$" + ), + "buildName": _SERIALIZER.url( + "build_name", build_name, "str", max_length=64, min_length=2, pattern=r"^[-\w\._\(\)]+$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, builder_name: str, build_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}/builds/{buildName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "builderName": _SERIALIZER.url( + "builder_name", builder_name, "str", max_length=32, min_length=2, pattern=r"^[-\w\._\(\)]+$" + ), + "buildName": _SERIALIZER.url( + "build_name", build_name, "str", max_length=64, min_length=2, pattern=r"^[-\w\._\(\)]+$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class BuildsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s + :attr:`builds` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get(self, resource_group_name: str, builder_name: str, build_name: str, **kwargs: Any) -> _models.BuildResource: + """Get a BuildResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param build_name: The name of a build. Required. + :type build_name: str + :return: BuildResource or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.BuildResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BuildResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + builder_name=builder_name, + build_name=build_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("BuildResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + builder_name: str, + build_name: str, + build_envelope: Union[_models.BuildResource, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(build_envelope, (IOBase, bytes)): + _content = build_envelope + else: + _json = self._serialize.body(build_envelope, "BuildResource") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + builder_name=builder_name, + build_name=build_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + builder_name: str, + build_name: str, + build_envelope: _models.BuildResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.BuildResource]: + """Create a BuildResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param build_name: The name of a build. Required. + :type build_name: str + :param build_envelope: Resource create or update parameters. Required. + :type build_envelope: ~azure.mgmt.appcontainers.models.BuildResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either BuildResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.BuildResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + builder_name: str, + build_name: str, + build_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.BuildResource]: + """Create a BuildResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param build_name: The name of a build. Required. + :type build_name: str + :param build_envelope: Resource create or update parameters. Required. + :type build_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either BuildResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.BuildResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + builder_name: str, + build_name: str, + build_envelope: Union[_models.BuildResource, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.BuildResource]: + """Create a BuildResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param build_name: The name of a build. Required. + :type build_name: str + :param build_envelope: Resource create or update parameters. Is either a BuildResource type or + a IO[bytes] type. Required. + :type build_envelope: ~azure.mgmt.appcontainers.models.BuildResource or IO[bytes] + :return: An instance of LROPoller that returns either BuildResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.BuildResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BuildResource] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + builder_name=builder_name, + build_name=build_name, + build_envelope=build_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("BuildResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.BuildResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.BuildResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, resource_group_name: str, builder_name: str, build_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + builder_name=builder_name, + build_name=build_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, resource_group_name: str, builder_name: str, build_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Delete a BuildResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param build_name: The name of a build. Required. + :type build_name: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + builder_name=builder_name, + build_name=build_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_certificates_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_certificates_operations.py index b52f67269b18..36e8d265de50 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_certificates_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_certificates_operations.py @@ -28,7 +28,6 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -47,7 +46,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -56,7 +55,7 @@ def build_list_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/certificates", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -80,7 +79,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -89,7 +88,7 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/certificates/{certificateName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -114,7 +113,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -124,7 +123,7 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/certificates/{certificateName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -151,7 +150,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -160,7 +159,7 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/certificates/{certificateName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -185,7 +184,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -195,7 +194,7 @@ def build_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/certificates/{certificateName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_connected_environments_certificates_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_connected_environments_certificates_operations.py index 5ee5787e9b13..83e1e99e488e 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 @@ -28,7 +28,6 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -47,7 +46,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -56,7 +55,7 @@ def build_list_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/certificates", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -84,7 +83,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -93,7 +92,7 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/certificates/{certificateName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -122,7 +121,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -132,7 +131,7 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/certificates/{certificateName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -163,7 +162,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -172,7 +171,7 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/certificates/{certificateName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -201,7 +200,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -211,7 +210,7 @@ def build_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/certificates/{certificateName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_connected_environments_dapr_components_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_connected_environments_dapr_components_operations.py index e17fc47ace78..0b8bfb9753a0 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 @@ -28,7 +28,6 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -47,7 +46,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -56,7 +55,7 @@ def build_list_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/daprComponents", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -80,7 +79,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -89,7 +88,7 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/daprComponents/{componentName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -114,7 +113,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -124,7 +123,7 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/daprComponents/{componentName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -151,7 +150,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -160,7 +159,7 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/daprComponents/{componentName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -185,7 +184,7 @@ def build_list_secrets_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -194,7 +193,7 @@ def build_list_secrets_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/daprComponents/{componentName}/listSecrets", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_connected_environments_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_connected_environments_operations.py index 8cc118ef41ed..ef3ba4e0eb42 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_connected_environments_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_connected_environments_operations.py @@ -32,7 +32,6 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -49,13 +48,13 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.App/connectedEnvironments") path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -73,7 +72,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -82,7 +81,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -105,7 +104,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -114,7 +113,7 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -138,7 +137,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -148,7 +147,7 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -174,7 +173,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -183,7 +182,7 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -207,7 +206,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -216,7 +215,7 @@ def build_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -240,7 +239,7 @@ def build_check_name_availability_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -250,7 +249,7 @@ def build_check_name_availability_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/checkNameAvailability", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_connected_environments_storages_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_connected_environments_storages_operations.py index b3af32c3d699..ca4ee82e2623 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 @@ -26,7 +26,6 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -45,7 +44,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -54,7 +53,7 @@ def build_list_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/storages", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -78,7 +77,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -87,7 +86,7 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/storages/{storageName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -112,7 +111,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -122,7 +121,7 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/storages/{storageName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -149,7 +148,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -158,7 +157,7 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/storages/{storageName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_api_client_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_api_client_operations.py index 1d368cb997b1..42a17070e70f 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_api_client_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_api_client_operations.py @@ -44,7 +44,7 @@ def build_job_execution_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -53,7 +53,7 @@ def build_job_execution_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/executions/{jobExecutionName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -80,7 +80,7 @@ def build_get_custom_domain_verification_id_request( # pylint: disable=name-too _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -88,7 +88,7 @@ def build_get_custom_domain_verification_id_request( # pylint: disable=name-too "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.App/getCustomDomainVerificationId" ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_auth_configs_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_auth_configs_operations.py index 9a3a95761f7a..aad3e7f178e2 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_auth_configs_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_auth_configs_operations.py @@ -28,7 +28,6 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -47,7 +46,7 @@ def build_list_by_container_app_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -56,7 +55,7 @@ def build_list_by_container_app_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/authConfigs", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -80,7 +79,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -89,7 +88,7 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/authConfigs/{authConfigName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -114,7 +113,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -124,7 +123,7 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/authConfigs/{authConfigName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -151,7 +150,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -160,7 +159,7 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/authConfigs/{authConfigName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_builds_by_container_app_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_builds_by_container_app_operations.py new file mode 100644 index 000000000000..c0c6bec4f1e7 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_builds_by_container_app_operations.py @@ -0,0 +1,180 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_request( + resource_group_name: str, container_app_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/builds", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "containerAppName": _SERIALIZER.url( + "container_app_name", container_app_name, "str", pattern=r"^[-\w\._\(\)]+$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class ContainerAppsBuildsByContainerAppOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s + :attr:`container_apps_builds_by_container_app` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, resource_group_name: str, container_app_name: str, **kwargs: Any + ) -> Iterable["_models.ContainerAppsBuildResource"]: + """List Container Apps Build resources by Container App. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App the Build is associated. Required. + :type container_app_name: str + :return: An iterator like instance of either ContainerAppsBuildResource or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.ContainerAppsBuildResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ContainerAppsBuildCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ContainerAppsBuildCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_builds_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_builds_operations.py new file mode 100644 index 000000000000..baa987a7159c --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_builds_operations.py @@ -0,0 +1,314 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, Iterator, Optional, Type, TypeVar, Union, cast + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_get_request( + resource_group_name: str, container_app_name: str, build_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/builds/{buildName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "containerAppName": _SERIALIZER.url( + "container_app_name", container_app_name, "str", pattern=r"^[-\w\._\(\)]+$" + ), + "buildName": _SERIALIZER.url( + "build_name", build_name, "str", max_length=64, min_length=2, pattern=r"^[-\w\._\(\)]+$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, container_app_name: str, build_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/builds/{buildName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "containerAppName": _SERIALIZER.url( + "container_app_name", container_app_name, "str", pattern=r"^[-\w\._\(\)]+$" + ), + "buildName": _SERIALIZER.url( + "build_name", build_name, "str", max_length=64, min_length=2, pattern=r"^[-\w\._\(\)]+$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class ContainerAppsBuildsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s + :attr:`container_apps_builds` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get( + self, resource_group_name: str, container_app_name: str, build_name: str, **kwargs: Any + ) -> _models.ContainerAppsBuildResource: + """Get a Container Apps Build resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App the Build is associated. Required. + :type container_app_name: str + :param build_name: The name of a build. Required. + :type build_name: str + :return: ContainerAppsBuildResource or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.ContainerAppsBuildResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ContainerAppsBuildResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + build_name=build_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ContainerAppsBuildResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _delete_initial( + self, resource_group_name: str, container_app_name: str, build_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + build_name=build_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, resource_group_name: str, container_app_name: str, build_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Delete a Container Apps Build resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App the Build is associated. Required. + :type container_app_name: str + :param build_name: The name of a build. Required. + :type build_name: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + build_name=build_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_diagnostics_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_diagnostics_operations.py index e44dfadc1c0c..3f459b466f63 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_diagnostics_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_diagnostics_operations.py @@ -27,7 +27,6 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -46,7 +45,7 @@ def build_list_detectors_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -55,7 +54,7 @@ def build_list_detectors_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/detectors", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -79,7 +78,7 @@ def build_get_detector_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -88,7 +87,7 @@ def build_get_detector_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/detectors/{detectorName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -118,7 +117,7 @@ def build_list_revisions_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -127,7 +126,7 @@ def build_list_revisions_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/detectorProperties/revisionsApi/revisions/", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -153,7 +152,7 @@ def build_get_revision_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -162,7 +161,7 @@ def build_get_revision_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/detectorProperties/revisionsApi/revisions/{revisionName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -187,7 +186,7 @@ def build_get_root_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -196,7 +195,7 @@ def build_get_root_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/detectorProperties/rootApi/", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_operations.py index 00cdac90d313..67267d32f72c 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_operations.py @@ -32,7 +32,6 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -49,13 +48,13 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.App/containerApps") path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -73,7 +72,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -82,7 +81,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -105,7 +104,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -114,7 +113,7 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -138,7 +137,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -148,7 +147,7 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -174,7 +173,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -183,7 +182,7 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -207,7 +206,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -217,7 +216,7 @@ def build_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -248,7 +247,7 @@ def build_list_custom_host_name_analysis_request( # pylint: disable=name-too-lo _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -257,7 +256,7 @@ def build_list_custom_host_name_analysis_request( # pylint: disable=name-too-lo "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/listCustomHostNameAnalysis", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -283,7 +282,7 @@ def build_list_secrets_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -292,7 +291,7 @@ def build_list_secrets_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/listSecrets", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -316,7 +315,7 @@ def build_get_auth_token_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -325,7 +324,7 @@ def build_get_auth_token_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/getAuthtoken", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -349,7 +348,7 @@ def build_start_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -358,7 +357,7 @@ def build_start_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/start", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -384,7 +383,7 @@ def build_stop_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -393,7 +392,7 @@ def build_stop_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/stop", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_patches_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_patches_operations.py new file mode 100644 index 000000000000..5ecf4eda2b9b --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_patches_operations.py @@ -0,0 +1,856 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_container_app_request( + resource_group_name: str, + container_app_name: str, + subscription_id: str, + *, + filter: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/patches", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "containerAppName": _SERIALIZER.url( + "container_app_name", container_app_name, "str", pattern=r"^[-\w\._\(\)]+$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, container_app_name: str, patch_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/patches/{patchName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "containerAppName": _SERIALIZER.url( + "container_app_name", container_app_name, "str", pattern=r"^[-\w\._\(\)]+$" + ), + "patchName": _SERIALIZER.url( + "patch_name", patch_name, "str", max_length=64, min_length=2, pattern=r"^[-\w\._\(\)]+$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, container_app_name: str, patch_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/patches/{patchName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "containerAppName": _SERIALIZER.url( + "container_app_name", container_app_name, "str", pattern=r"^[-\w\._\(\)]+$" + ), + "patchName": _SERIALIZER.url( + "patch_name", patch_name, "str", max_length=64, min_length=2, pattern=r"^[-\w\._\(\)]+$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_skip_configure_request( + resource_group_name: str, container_app_name: str, patch_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/patches/{patchName}/skipConfig", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "containerAppName": _SERIALIZER.url( + "container_app_name", container_app_name, "str", pattern=r"^[-\w\._\(\)]+$" + ), + "patchName": _SERIALIZER.url( + "patch_name", patch_name, "str", max_length=64, min_length=2, pattern=r"^[-\w\._\(\)]+$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_apply_request( + resource_group_name: str, container_app_name: str, patch_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/patches/{patchName}/apply", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "containerAppName": _SERIALIZER.url( + "container_app_name", container_app_name, "str", pattern=r"^[-\w\._\(\)]+$" + ), + "patchName": _SERIALIZER.url( + "patch_name", patch_name, "str", max_length=64, min_length=2, pattern=r"^[-\w\._\(\)]+$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class ContainerAppsPatchesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s + :attr:`container_apps_patches` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_container_app( + self, resource_group_name: str, container_app_name: str, filter: Optional[str] = None, **kwargs: Any + ) -> Iterable["_models.ContainerAppsPatchResource"]: + """List Container Apps Patch resources by ContainerApp. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App the Patch is associated. Required. + :type container_app_name: str + :param filter: The filter to apply on the operation. For example, + $filter=properties/patchApplyStatus eq 'Succeeded'. Default value is None. + :type filter: str + :return: An iterator like instance of either ContainerAppsPatchResource or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.ContainerAppsPatchResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.PatchCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_container_app_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + subscription_id=self._config.subscription_id, + filter=filter, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("PatchCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get( + self, resource_group_name: str, container_app_name: str, patch_name: str, **kwargs: Any + ) -> _models.ContainerAppsPatchResource: + """Get details for specific Container Apps Patch by patch name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App the Patch is associated. Required. + :type container_app_name: str + :param patch_name: The name of the patch. Required. + :type patch_name: str + :return: ContainerAppsPatchResource or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.ContainerAppsPatchResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ContainerAppsPatchResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + patch_name=patch_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ContainerAppsPatchResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _delete_initial( + self, resource_group_name: str, container_app_name: str, patch_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + patch_name=patch_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, resource_group_name: str, container_app_name: str, patch_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Delete specific Container Apps Patch by patch name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App the Patch is associated. Required. + :type container_app_name: str + :param patch_name: The name of the patch. Required. + :type patch_name: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + patch_name=patch_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _skip_configure_initial( + self, + resource_group_name: str, + container_app_name: str, + patch_name: str, + patch_skip_config: Union[_models.PatchSkipConfig, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(patch_skip_config, (IOBase, bytes)): + _content = patch_skip_config + else: + _json = self._serialize.body(patch_skip_config, "PatchSkipConfig") + + _request = build_skip_configure_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + patch_name=patch_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_skip_configure( + self, + resource_group_name: str, + container_app_name: str, + patch_name: str, + patch_skip_config: _models.PatchSkipConfig, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Configure the Container Apps Patch skip option by patch name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App the Patch is associated. Required. + :type container_app_name: str + :param patch_name: The name of the patch. Required. + :type patch_name: str + :param patch_skip_config: Configure patcher to skip a patch or not. Required. + :type patch_skip_config: ~azure.mgmt.appcontainers.models.PatchSkipConfig + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_skip_configure( + self, + resource_group_name: str, + container_app_name: str, + patch_name: str, + patch_skip_config: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Configure the Container Apps Patch skip option by patch name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App the Patch is associated. Required. + :type container_app_name: str + :param patch_name: The name of the patch. Required. + :type patch_name: str + :param patch_skip_config: Configure patcher to skip a patch or not. Required. + :type patch_skip_config: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_skip_configure( + self, + resource_group_name: str, + container_app_name: str, + patch_name: str, + patch_skip_config: Union[_models.PatchSkipConfig, IO[bytes]], + **kwargs: Any + ) -> LROPoller[None]: + """Configure the Container Apps Patch skip option by patch name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App the Patch is associated. Required. + :type container_app_name: str + :param patch_name: The name of the patch. Required. + :type patch_name: str + :param patch_skip_config: Configure patcher to skip a patch or not. Is either a PatchSkipConfig + type or a IO[bytes] type. Required. + :type patch_skip_config: ~azure.mgmt.appcontainers.models.PatchSkipConfig or IO[bytes] + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._skip_configure_initial( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + patch_name=patch_name, + patch_skip_config=patch_skip_config, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _apply_initial( + self, resource_group_name: str, container_app_name: str, patch_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_apply_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + patch_name=patch_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_apply( + self, resource_group_name: str, container_app_name: str, patch_name: str, **kwargs: Any + ) -> LROPoller[_models.ContainerAppsPatchResource]: + """Apply a Container Apps Patch resource with patch name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App the Patch is associated. Required. + :type container_app_name: str + :param patch_name: The name of the patch. Required. + :type patch_name: str + :return: An instance of LROPoller that returns either ContainerAppsPatchResource or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.ContainerAppsPatchResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ContainerAppsPatchResource] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._apply_initial( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + patch_name=patch_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ContainerAppsPatchResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.ContainerAppsPatchResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ContainerAppsPatchResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_revision_replicas_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_revision_replicas_operations.py index d268ee7cc212..5dc5a5a20868 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_revision_replicas_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_revision_replicas_operations.py @@ -25,7 +25,6 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -49,7 +48,7 @@ def build_get_replica_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -58,7 +57,7 @@ def build_get_replica_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{revisionName}/replicas/{replicaName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -84,7 +83,7 @@ def build_list_replicas_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -93,7 +92,7 @@ def build_list_replicas_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{revisionName}/replicas", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_revisions_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_revisions_operations.py index cfe88374040c..36516fbefb0d 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_revisions_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_revisions_operations.py @@ -27,7 +27,6 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -51,7 +50,7 @@ def build_list_revisions_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -60,7 +59,7 @@ def build_list_revisions_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -86,7 +85,7 @@ def build_get_revision_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -95,7 +94,7 @@ def build_get_revision_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{revisionName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -120,7 +119,7 @@ def build_activate_revision_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -129,7 +128,7 @@ def build_activate_revision_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{revisionName}/activate", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -154,7 +153,7 @@ def build_deactivate_revision_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -163,7 +162,7 @@ def build_deactivate_revision_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{revisionName}/deactivate", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -188,7 +187,7 @@ def build_restart_revision_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -197,7 +196,7 @@ def build_restart_revision_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{revisionName}/restart", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_session_pools_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_session_pools_operations.py new file mode 100644 index 000000000000..005c216efb9e --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_session_pools_operations.py @@ -0,0 +1,997 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.App/sessionPools") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/sessionPools", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, session_pool_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/sessionPools/{sessionPoolName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "sessionPoolName": _SERIALIZER.url( + "session_pool_name", session_pool_name, "str", max_length=63, min_length=3, pattern=r"^[a-z][a-z0-9]*$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, session_pool_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/sessionPools/{sessionPoolName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "sessionPoolName": _SERIALIZER.url( + "session_pool_name", session_pool_name, "str", max_length=63, min_length=3, pattern=r"^[a-z][a-z0-9]*$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request( + resource_group_name: str, session_pool_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/sessionPools/{sessionPoolName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "sessionPoolName": _SERIALIZER.url( + "session_pool_name", session_pool_name, "str", max_length=63, min_length=3, pattern=r"^[a-z][a-z0-9]*$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, session_pool_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/sessionPools/{sessionPoolName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "sessionPoolName": _SERIALIZER.url( + "session_pool_name", session_pool_name, "str", max_length=63, min_length=3, pattern=r"^[a-z][a-z0-9]*$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class ContainerAppsSessionPoolsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s + :attr:`container_apps_session_pools` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.SessionPool"]: + """Get the session pools in a given subscription. + + Get the session pools in a given subscription. + + :return: An iterator like instance of either SessionPool or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.SessionPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SessionPoolCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("SessionPoolCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.SessionPool"]: + """Get the session pools in a given resource group of a subscription. + + Get the session pools in a given resource group of a subscription. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of either SessionPool or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.SessionPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SessionPoolCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("SessionPoolCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get(self, resource_group_name: str, session_pool_name: str, **kwargs: Any) -> _models.SessionPool: + """Get the properties of a session pool. + + Get the properties of a session pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param session_pool_name: Name of the session pool. Required. + :type session_pool_name: str + :return: SessionPool or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.SessionPool + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SessionPool] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + session_pool_name=session_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SessionPool", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + session_pool_name: str, + session_pool_envelope: Union[_models.SessionPool, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(session_pool_envelope, (IOBase, bytes)): + _content = session_pool_envelope + else: + _json = self._serialize.body(session_pool_envelope, "SessionPool") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + session_pool_name=session_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + session_pool_name: str, + session_pool_envelope: _models.SessionPool, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.SessionPool]: + """Create or update a session pool. + + Create or update a session pool with the given properties. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param session_pool_name: Name of the session pool. Required. + :type session_pool_name: str + :param session_pool_envelope: Properties used to create a session pool. Required. + :type session_pool_envelope: ~azure.mgmt.appcontainers.models.SessionPool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either SessionPool or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.SessionPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + session_pool_name: str, + session_pool_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.SessionPool]: + """Create or update a session pool. + + Create or update a session pool with the given properties. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param session_pool_name: Name of the session pool. Required. + :type session_pool_name: str + :param session_pool_envelope: Properties used to create a session pool. Required. + :type session_pool_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either SessionPool or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.SessionPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + session_pool_name: str, + session_pool_envelope: Union[_models.SessionPool, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.SessionPool]: + """Create or update a session pool. + + Create or update a session pool with the given properties. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param session_pool_name: Name of the session pool. Required. + :type session_pool_name: str + :param session_pool_envelope: Properties used to create a session pool. Is either a SessionPool + type or a IO[bytes] type. Required. + :type session_pool_envelope: ~azure.mgmt.appcontainers.models.SessionPool or IO[bytes] + :return: An instance of LROPoller that returns either SessionPool or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.SessionPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SessionPool] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + session_pool_name=session_pool_name, + session_pool_envelope=session_pool_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("SessionPool", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.SessionPool].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.SessionPool]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _update_initial( + self, + resource_group_name: str, + session_pool_name: str, + session_pool_envelope: Union[_models.SessionPoolUpdatableProperties, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(session_pool_envelope, (IOBase, bytes)): + _content = session_pool_envelope + else: + _json = self._serialize.body(session_pool_envelope, "SessionPoolUpdatableProperties") + + _request = build_update_request( + resource_group_name=resource_group_name, + session_pool_name=session_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + session_pool_name: str, + session_pool_envelope: _models.SessionPoolUpdatableProperties, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.SessionPool]: + """Update properties of a session pool. + + Patches a session pool using JSON merge patch. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param session_pool_name: Name of the session pool. Required. + :type session_pool_name: str + :param session_pool_envelope: Properties used to create a session pool. Required. + :type session_pool_envelope: ~azure.mgmt.appcontainers.models.SessionPoolUpdatableProperties + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either SessionPool or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.SessionPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + session_pool_name: str, + session_pool_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.SessionPool]: + """Update properties of a session pool. + + Patches a session pool using JSON merge patch. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param session_pool_name: Name of the session pool. Required. + :type session_pool_name: str + :param session_pool_envelope: Properties used to create a session pool. Required. + :type session_pool_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either SessionPool or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.SessionPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + session_pool_name: str, + session_pool_envelope: Union[_models.SessionPoolUpdatableProperties, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.SessionPool]: + """Update properties of a session pool. + + Patches a session pool using JSON merge patch. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param session_pool_name: Name of the session pool. Required. + :type session_pool_name: str + :param session_pool_envelope: Properties used to create a session pool. Is either a + SessionPoolUpdatableProperties type or a IO[bytes] type. Required. + :type session_pool_envelope: ~azure.mgmt.appcontainers.models.SessionPoolUpdatableProperties or + IO[bytes] + :return: An instance of LROPoller that returns either SessionPool or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.SessionPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SessionPool] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + session_pool_name=session_pool_name, + session_pool_envelope=session_pool_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("SessionPool", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.SessionPool].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.SessionPool]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial(self, resource_group_name: str, session_pool_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + session_pool_name=session_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete(self, resource_group_name: str, session_pool_name: str, **kwargs: Any) -> LROPoller[None]: + """Delete a session pool. + + Delete the session pool with the given name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param session_pool_name: Name of the session pool. Required. + :type session_pool_name: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + session_pool_name=session_pool_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_source_controls_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_source_controls_operations.py index 16bfd652f7ff..e546fc010ddf 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_source_controls_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_source_controls_operations.py @@ -32,7 +32,6 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -51,7 +50,7 @@ def build_list_by_container_app_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -60,7 +59,7 @@ def build_list_by_container_app_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/sourcecontrols", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -84,7 +83,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -93,7 +92,7 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/sourcecontrols/{sourceControlName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -113,12 +112,18 @@ def build_get_request( def build_create_or_update_request( - resource_group_name: str, container_app_name: str, source_control_name: str, subscription_id: str, **kwargs: Any + resource_group_name: str, + container_app_name: str, + source_control_name: str, + subscription_id: str, + *, + x_ms_github_auxiliary: Optional[str] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -128,7 +133,7 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/sourcecontrols/{sourceControlName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -142,6 +147,8 @@ def build_create_or_update_request( _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if x_ms_github_auxiliary is not None: + _headers["x-ms-github-auxiliary"] = _SERIALIZER.header("x_ms_github_auxiliary", x_ms_github_auxiliary, "str") if content_type is not None: _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -150,12 +157,20 @@ def build_create_or_update_request( def build_delete_request( - resource_group_name: str, container_app_name: str, source_control_name: str, subscription_id: str, **kwargs: Any + resource_group_name: str, + container_app_name: str, + source_control_name: str, + subscription_id: str, + *, + x_ms_github_auxiliary: Optional[str] = None, + ignore_workflow_deletion_failure: Optional[bool] = None, + delete_workflow: Optional[bool] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -164,7 +179,7 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/sourcecontrols/{sourceControlName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -175,9 +190,17 @@ def build_delete_request( _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters + if ignore_workflow_deletion_failure is not None: + _params["ignoreWorkflowDeletionFailure"] = _SERIALIZER.query( + "ignore_workflow_deletion_failure", ignore_workflow_deletion_failure, "bool" + ) + if delete_workflow is not None: + _params["deleteWorkflow"] = _SERIALIZER.query("delete_workflow", delete_workflow, "bool") _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if x_ms_github_auxiliary is not None: + _headers["x-ms-github-auxiliary"] = _SERIALIZER.header("x_ms_github_auxiliary", x_ms_github_auxiliary, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) @@ -357,6 +380,7 @@ def _create_or_update_initial( container_app_name: str, source_control_name: str, source_control_envelope: Union[_models.SourceControl, IO[bytes]], + x_ms_github_auxiliary: Optional[str] = None, **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -387,6 +411,7 @@ def _create_or_update_initial( container_app_name=container_app_name, source_control_name=source_control_name, subscription_id=self._config.subscription_id, + x_ms_github_auxiliary=x_ms_github_auxiliary, api_version=api_version, content_type=content_type, json=_json, @@ -427,6 +452,7 @@ def begin_create_or_update( container_app_name: str, source_control_name: str, source_control_envelope: _models.SourceControl, + x_ms_github_auxiliary: Optional[str] = None, *, content_type: str = "application/json", **kwargs: Any @@ -445,6 +471,9 @@ def begin_create_or_update( :param source_control_envelope: Properties used to create a Container App SourceControl. Required. :type source_control_envelope: ~azure.mgmt.appcontainers.models.SourceControl + :param x_ms_github_auxiliary: Github personal access token used for SourceControl. Default + value is None. + :type x_ms_github_auxiliary: str :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -461,6 +490,7 @@ def begin_create_or_update( container_app_name: str, source_control_name: str, source_control_envelope: IO[bytes], + x_ms_github_auxiliary: Optional[str] = None, *, content_type: str = "application/json", **kwargs: Any @@ -479,6 +509,9 @@ def begin_create_or_update( :param source_control_envelope: Properties used to create a Container App SourceControl. Required. :type source_control_envelope: IO[bytes] + :param x_ms_github_auxiliary: Github personal access token used for SourceControl. Default + value is None. + :type x_ms_github_auxiliary: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -495,6 +528,7 @@ def begin_create_or_update( container_app_name: str, source_control_name: str, source_control_envelope: Union[_models.SourceControl, IO[bytes]], + x_ms_github_auxiliary: Optional[str] = None, **kwargs: Any ) -> LROPoller[_models.SourceControl]: """Create or update the SourceControl for a Container App. @@ -511,6 +545,9 @@ def begin_create_or_update( :param source_control_envelope: Properties used to create a Container App SourceControl. Is either a SourceControl type or a IO[bytes] type. Required. :type source_control_envelope: ~azure.mgmt.appcontainers.models.SourceControl or IO[bytes] + :param x_ms_github_auxiliary: Github personal access token used for SourceControl. Default + value is None. + :type x_ms_github_auxiliary: str :return: An instance of LROPoller that returns either SourceControl or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.SourceControl] @@ -531,6 +568,7 @@ def begin_create_or_update( container_app_name=container_app_name, source_control_name=source_control_name, source_control_envelope=source_control_envelope, + x_ms_github_auxiliary=x_ms_github_auxiliary, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -565,7 +603,14 @@ def get_long_running_output(pipeline_response): ) def _delete_initial( - self, resource_group_name: str, container_app_name: str, source_control_name: str, **kwargs: Any + self, + resource_group_name: str, + container_app_name: str, + source_control_name: str, + x_ms_github_auxiliary: Optional[str] = None, + ignore_workflow_deletion_failure: Optional[bool] = None, + delete_workflow: Optional[bool] = None, + **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, @@ -586,6 +631,9 @@ def _delete_initial( container_app_name=container_app_name, source_control_name=source_control_name, subscription_id=self._config.subscription_id, + x_ms_github_auxiliary=x_ms_github_auxiliary, + ignore_workflow_deletion_failure=ignore_workflow_deletion_failure, + delete_workflow=delete_workflow, api_version=api_version, headers=_headers, params=_params, @@ -618,7 +666,14 @@ def _delete_initial( @distributed_trace def begin_delete( - self, resource_group_name: str, container_app_name: str, source_control_name: str, **kwargs: Any + self, + resource_group_name: str, + container_app_name: str, + source_control_name: str, + x_ms_github_auxiliary: Optional[str] = None, + ignore_workflow_deletion_failure: Optional[bool] = None, + delete_workflow: Optional[bool] = None, + **kwargs: Any ) -> LROPoller[None]: """Delete a Container App SourceControl. @@ -631,6 +686,14 @@ def begin_delete( :type container_app_name: str :param source_control_name: Name of the Container App SourceControl. Required. :type source_control_name: str + :param x_ms_github_auxiliary: Github personal access token used for SourceControl. Default + value is None. + :type x_ms_github_auxiliary: str + :param ignore_workflow_deletion_failure: Ignore Workflow Deletion Failure. Default value is + None. + :type ignore_workflow_deletion_failure: bool + :param delete_workflow: Delete workflow. Default value is None. + :type delete_workflow: bool :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -648,6 +711,9 @@ def begin_delete( resource_group_name=resource_group_name, container_app_name=container_app_name, source_control_name=source_control_name, + x_ms_github_auxiliary=x_ms_github_auxiliary, + ignore_workflow_deletion_failure=ignore_workflow_deletion_failure, + delete_workflow=delete_workflow, api_version=api_version, cls=lambda x, y, z: x, headers=_headers, diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_dapr_component_resiliency_policies_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_dapr_component_resiliency_policies_operations.py new file mode 100644 index 000000000000..045f7dd750c2 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_dapr_component_resiliency_policies_operations.py @@ -0,0 +1,583 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_request( + resource_group_name: str, environment_name: str, component_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{componentName}/resiliencyPolicies", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "environmentName": _SERIALIZER.url("environment_name", environment_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "componentName": _SERIALIZER.url("component_name", component_name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, environment_name: str, component_name: str, name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{componentName}/resiliencyPolicies/{name}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "environmentName": _SERIALIZER.url("environment_name", environment_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "componentName": _SERIALIZER.url("component_name", component_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "name": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, environment_name: str, component_name: str, name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{componentName}/resiliencyPolicies/{name}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "environmentName": _SERIALIZER.url("environment_name", environment_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "componentName": _SERIALIZER.url("component_name", component_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "name": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, environment_name: str, component_name: str, name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{componentName}/resiliencyPolicies/{name}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "environmentName": _SERIALIZER.url("environment_name", environment_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "componentName": _SERIALIZER.url("component_name", component_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "name": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class DaprComponentResiliencyPoliciesOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s + :attr:`dapr_component_resiliency_policies` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, resource_group_name: str, environment_name: str, component_name: str, **kwargs: Any + ) -> Iterable["_models.DaprComponentResiliencyPolicy"]: + """Get the resiliency policies for a Dapr component. + + Get the resiliency policies for a Dapr component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param component_name: Name of the Dapr Component. Required. + :type component_name: str + :return: An iterator like instance of either DaprComponentResiliencyPolicy or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicy] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DaprComponentResiliencyPoliciesCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + component_name=component_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("DaprComponentResiliencyPoliciesCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get( + self, resource_group_name: str, environment_name: str, component_name: str, name: str, **kwargs: Any + ) -> _models.DaprComponentResiliencyPolicy: + """Get a Dapr component resiliency policy. + + Get a Dapr component resiliency policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param component_name: Name of the Dapr Component. Required. + :type component_name: str + :param name: Name of the Dapr Component Resiliency Policy. Required. + :type name: str + :return: DaprComponentResiliencyPolicy or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DaprComponentResiliencyPolicy] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + component_name=component_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("DaprComponentResiliencyPolicy", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def create_or_update( + self, + resource_group_name: str, + environment_name: str, + component_name: str, + name: str, + dapr_component_resiliency_policy_envelope: _models.DaprComponentResiliencyPolicy, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DaprComponentResiliencyPolicy: + """Creates or updates a Dapr component resiliency policy. + + Creates or updates a resiliency policy for a Dapr component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param component_name: Name of the Dapr Component. Required. + :type component_name: str + :param name: Name of the Dapr Component Resiliency Policy. Required. + :type name: str + :param dapr_component_resiliency_policy_envelope: Configuration details of the Dapr Component + Resiliency Policy. Required. + :type dapr_component_resiliency_policy_envelope: + ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicy + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: DaprComponentResiliencyPolicy or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + environment_name: str, + component_name: str, + name: str, + dapr_component_resiliency_policy_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DaprComponentResiliencyPolicy: + """Creates or updates a Dapr component resiliency policy. + + Creates or updates a resiliency policy for a Dapr component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param component_name: Name of the Dapr Component. Required. + :type component_name: str + :param name: Name of the Dapr Component Resiliency Policy. Required. + :type name: str + :param dapr_component_resiliency_policy_envelope: Configuration details of the Dapr Component + Resiliency Policy. Required. + :type dapr_component_resiliency_policy_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: DaprComponentResiliencyPolicy or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + environment_name: str, + component_name: str, + name: str, + dapr_component_resiliency_policy_envelope: Union[_models.DaprComponentResiliencyPolicy, IO[bytes]], + **kwargs: Any + ) -> _models.DaprComponentResiliencyPolicy: + """Creates or updates a Dapr component resiliency policy. + + Creates or updates a resiliency policy for a Dapr component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param component_name: Name of the Dapr Component. Required. + :type component_name: str + :param name: Name of the Dapr Component Resiliency Policy. Required. + :type name: str + :param dapr_component_resiliency_policy_envelope: Configuration details of the Dapr Component + Resiliency Policy. Is either a DaprComponentResiliencyPolicy type or a IO[bytes] type. + Required. + :type dapr_component_resiliency_policy_envelope: + ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicy or IO[bytes] + :return: DaprComponentResiliencyPolicy or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DaprComponentResiliencyPolicy] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(dapr_component_resiliency_policy_envelope, (IOBase, bytes)): + _content = dapr_component_resiliency_policy_envelope + else: + _json = self._serialize.body(dapr_component_resiliency_policy_envelope, "DaprComponentResiliencyPolicy") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + component_name=component_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("DaprComponentResiliencyPolicy", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, environment_name: str, component_name: str, name: str, **kwargs: Any + ) -> None: + """Delete a Dapr component resiliency policy. + + Delete a resiliency policy for a Dapr component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param component_name: Name of the Dapr Component. Required. + :type component_name: str + :param name: Name of the Dapr Component Resiliency Policy. Required. + :type name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + component_name=component_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_dapr_components_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_dapr_components_operations.py index a73f5b7efe74..8d9e32077cec 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_dapr_components_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_dapr_components_operations.py @@ -28,7 +28,6 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -47,7 +46,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -56,7 +55,7 @@ def build_list_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -80,7 +79,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -89,7 +88,7 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{componentName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -114,7 +113,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -124,7 +123,7 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{componentName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -151,7 +150,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -160,7 +159,7 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{componentName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -185,7 +184,7 @@ def build_list_secrets_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -194,7 +193,7 @@ def build_list_secrets_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{componentName}/listSecrets", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_dapr_subscriptions_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_dapr_subscriptions_operations.py new file mode 100644 index 000000000000..e629225b8b27 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_dapr_subscriptions_operations.py @@ -0,0 +1,554 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_request( + resource_group_name: str, environment_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprSubscriptions", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "environmentName": _SERIALIZER.url("environment_name", environment_name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, environment_name: str, name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprSubscriptions/{name}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "environmentName": _SERIALIZER.url("environment_name", environment_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "name": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, environment_name: str, name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprSubscriptions/{name}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "environmentName": _SERIALIZER.url("environment_name", environment_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "name": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, environment_name: str, name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprSubscriptions/{name}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "environmentName": _SERIALIZER.url("environment_name", environment_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "name": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class DaprSubscriptionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s + :attr:`dapr_subscriptions` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, resource_group_name: str, environment_name: str, **kwargs: Any + ) -> Iterable["_models.DaprSubscription"]: + """Get the Dapr subscriptions for a managed environment. + + Get the Dapr subscriptions for a managed environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :return: An iterator like instance of either DaprSubscription or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.DaprSubscription] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DaprSubscriptionsCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("DaprSubscriptionsCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get( + self, resource_group_name: str, environment_name: str, name: str, **kwargs: Any + ) -> _models.DaprSubscription: + """Get a dapr subscription. + + Get a dapr subscription. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the Dapr subscription. Required. + :type name: str + :return: DaprSubscription or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.DaprSubscription + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DaprSubscription] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("DaprSubscription", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def create_or_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + dapr_subscription_envelope: _models.DaprSubscription, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DaprSubscription: + """Creates or updates a Dapr subscription. + + Creates or updates a Dapr subscription in a Managed Environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the Dapr subscription. Required. + :type name: str + :param dapr_subscription_envelope: Configuration details of the Dapr subscription. Required. + :type dapr_subscription_envelope: ~azure.mgmt.appcontainers.models.DaprSubscription + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: DaprSubscription or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.DaprSubscription + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + dapr_subscription_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DaprSubscription: + """Creates or updates a Dapr subscription. + + Creates or updates a Dapr subscription in a Managed Environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the Dapr subscription. Required. + :type name: str + :param dapr_subscription_envelope: Configuration details of the Dapr subscription. Required. + :type dapr_subscription_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: DaprSubscription or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.DaprSubscription + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + dapr_subscription_envelope: Union[_models.DaprSubscription, IO[bytes]], + **kwargs: Any + ) -> _models.DaprSubscription: + """Creates or updates a Dapr subscription. + + Creates or updates a Dapr subscription in a Managed Environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the Dapr subscription. Required. + :type name: str + :param dapr_subscription_envelope: Configuration details of the Dapr subscription. Is either a + DaprSubscription type or a IO[bytes] type. Required. + :type dapr_subscription_envelope: ~azure.mgmt.appcontainers.models.DaprSubscription or + IO[bytes] + :return: DaprSubscription or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.DaprSubscription + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DaprSubscription] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(dapr_subscription_envelope, (IOBase, bytes)): + _content = dapr_subscription_envelope + else: + _json = self._serialize.body(dapr_subscription_envelope, "DaprSubscription") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("DaprSubscription", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, environment_name: str, name: str, **kwargs: Any + ) -> None: + """Delete a Dapr subscription. + + Delete a Dapr subscription from a Managed Environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the Dapr subscription. Required. + :type name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_dot_net_components_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_dot_net_components_operations.py new file mode 100644 index 000000000000..bf63632ced24 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_dot_net_components_operations.py @@ -0,0 +1,932 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_request( + resource_group_name: str, environment_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/dotNetComponents", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "environmentName": _SERIALIZER.url("environment_name", environment_name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, environment_name: str, name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/dotNetComponents/{name}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "environmentName": _SERIALIZER.url("environment_name", environment_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "name": _SERIALIZER.url("name", name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, environment_name: str, name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/dotNetComponents/{name}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "environmentName": _SERIALIZER.url("environment_name", environment_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "name": _SERIALIZER.url("name", name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request( + resource_group_name: str, environment_name: str, name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/dotNetComponents/{name}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "environmentName": _SERIALIZER.url("environment_name", environment_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "name": _SERIALIZER.url("name", name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, environment_name: str, name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/dotNetComponents/{name}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "environmentName": _SERIALIZER.url("environment_name", environment_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "name": _SERIALIZER.url("name", name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class DotNetComponentsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s + :attr:`dot_net_components` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, resource_group_name: str, environment_name: str, **kwargs: Any + ) -> Iterable["_models.DotNetComponent"]: + """Get the .NET Components for a managed environment. + + Get the .NET Components for a managed environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :return: An iterator like instance of either DotNetComponent or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.DotNetComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DotNetComponentsCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("DotNetComponentsCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get(self, resource_group_name: str, environment_name: str, name: str, **kwargs: Any) -> _models.DotNetComponent: + """Get a .NET Component. + + Get a .NET Component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the .NET Component. Required. + :type name: str + :return: DotNetComponent or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.DotNetComponent + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DotNetComponent] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("DotNetComponent", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + environment_name: str, + name: str, + dot_net_component_envelope: Union[_models.DotNetComponent, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(dot_net_component_envelope, (IOBase, bytes)): + _content = dot_net_component_envelope + else: + _json = self._serialize.body(dot_net_component_envelope, "DotNetComponent") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + dot_net_component_envelope: _models.DotNetComponent, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.DotNetComponent]: + """Creates or updates a .NET Component. + + Creates or updates a .NET Component in a Managed Environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the .NET Component. Required. + :type name: str + :param dot_net_component_envelope: Configuration details of the .NET Component. Required. + :type dot_net_component_envelope: ~azure.mgmt.appcontainers.models.DotNetComponent + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either DotNetComponent or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.DotNetComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + dot_net_component_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.DotNetComponent]: + """Creates or updates a .NET Component. + + Creates or updates a .NET Component in a Managed Environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the .NET Component. Required. + :type name: str + :param dot_net_component_envelope: Configuration details of the .NET Component. Required. + :type dot_net_component_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either DotNetComponent or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.DotNetComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + dot_net_component_envelope: Union[_models.DotNetComponent, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.DotNetComponent]: + """Creates or updates a .NET Component. + + Creates or updates a .NET Component in a Managed Environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the .NET Component. Required. + :type name: str + :param dot_net_component_envelope: Configuration details of the .NET Component. Is either a + DotNetComponent type or a IO[bytes] type. Required. + :type dot_net_component_envelope: ~azure.mgmt.appcontainers.models.DotNetComponent or IO[bytes] + :return: An instance of LROPoller that returns either DotNetComponent or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.DotNetComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DotNetComponent] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + dot_net_component_envelope=dot_net_component_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("DotNetComponent", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.DotNetComponent].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.DotNetComponent]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _update_initial( + self, + resource_group_name: str, + environment_name: str, + name: str, + dot_net_component_envelope: Union[_models.DotNetComponent, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(dot_net_component_envelope, (IOBase, bytes)): + _content = dot_net_component_envelope + else: + _json = self._serialize.body(dot_net_component_envelope, "DotNetComponent") + + _request = build_update_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + dot_net_component_envelope: _models.DotNetComponent, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.DotNetComponent]: + """Update properties of a .NET Component. + + Patches a .NET Component using JSON Merge Patch. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the .NET Component. Required. + :type name: str + :param dot_net_component_envelope: Configuration details of the .NET Component. Required. + :type dot_net_component_envelope: ~azure.mgmt.appcontainers.models.DotNetComponent + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either DotNetComponent or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.DotNetComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + dot_net_component_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.DotNetComponent]: + """Update properties of a .NET Component. + + Patches a .NET Component using JSON Merge Patch. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the .NET Component. Required. + :type name: str + :param dot_net_component_envelope: Configuration details of the .NET Component. Required. + :type dot_net_component_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either DotNetComponent or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.DotNetComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + dot_net_component_envelope: Union[_models.DotNetComponent, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.DotNetComponent]: + """Update properties of a .NET Component. + + Patches a .NET Component using JSON Merge Patch. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the .NET Component. Required. + :type name: str + :param dot_net_component_envelope: Configuration details of the .NET Component. Is either a + DotNetComponent type or a IO[bytes] type. Required. + :type dot_net_component_envelope: ~azure.mgmt.appcontainers.models.DotNetComponent or IO[bytes] + :return: An instance of LROPoller that returns either DotNetComponent or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.DotNetComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DotNetComponent] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + dot_net_component_envelope=dot_net_component_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("DotNetComponent", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.DotNetComponent].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.DotNetComponent]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, resource_group_name: str, environment_name: str, name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, resource_group_name: str, environment_name: str, name: str, **kwargs: Any + ) -> LROPoller[None]: + """Delete a .NET Component. + + Delete a .NET Component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the .NET Component. Required. + :type name: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_functions_extension_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_functions_extension_operations.py new file mode 100644 index 000000000000..6f8a36799039 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_functions_extension_operations.py @@ -0,0 +1,170 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_invoke_functions_host_request( + resource_group_name: str, + container_app_name: str, + revision_name: str, + function_app_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{revisionName}/providers/Microsoft.App/functions/{functionAppName}/invoke", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "containerAppName": _SERIALIZER.url( + "container_app_name", container_app_name, "str", pattern=r"^[-\w\._\(\)]+$" + ), + "revisionName": _SERIALIZER.url("revision_name", revision_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "functionAppName": _SERIALIZER.url("function_app_name", function_app_name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class FunctionsExtensionOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s + :attr:`functions_extension` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def invoke_functions_host( + self, + resource_group_name: str, + container_app_name: str, + revision_name: str, + function_app_name: str, + **kwargs: Any + ) -> str: + """Proxies a Functions host call to the function app backed by the container app. + + Proxies a Functions host call to the function app backed by the container app. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param revision_name: Name of the Container App Revision, the parent resource. Required. + :type revision_name: str + :param function_app_name: Name of the Function App, the extension resource. Required. + :type function_app_name: str + :return: str or the result of cls(response) + :rtype: str + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[str] = kwargs.pop("cls", None) + + _request = build_invoke_functions_host_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + revision_name=revision_name, + function_app_name=function_app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("str", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_java_components_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_java_components_operations.py new file mode 100644 index 000000000000..d3f5eb6f249c --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_java_components_operations.py @@ -0,0 +1,930 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_request( + resource_group_name: str, environment_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/javaComponents", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "environmentName": _SERIALIZER.url("environment_name", environment_name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, environment_name: str, name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/javaComponents/{name}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "environmentName": _SERIALIZER.url("environment_name", environment_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "name": _SERIALIZER.url("name", name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, environment_name: str, name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/javaComponents/{name}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "environmentName": _SERIALIZER.url("environment_name", environment_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "name": _SERIALIZER.url("name", name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request( + resource_group_name: str, environment_name: str, name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/javaComponents/{name}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "environmentName": _SERIALIZER.url("environment_name", environment_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "name": _SERIALIZER.url("name", name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, environment_name: str, name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/javaComponents/{name}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "environmentName": _SERIALIZER.url("environment_name", environment_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "name": _SERIALIZER.url("name", name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class JavaComponentsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s + :attr:`java_components` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list(self, resource_group_name: str, environment_name: str, **kwargs: Any) -> Iterable["_models.JavaComponent"]: + """Get the Java Components for a managed environment. + + Get the Java Components for a managed environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :return: An iterator like instance of either JavaComponent or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.JavaComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.JavaComponentsCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("JavaComponentsCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get(self, resource_group_name: str, environment_name: str, name: str, **kwargs: Any) -> _models.JavaComponent: + """Get a Java Component. + + Get a Java Component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the Java Component. Required. + :type name: str + :return: JavaComponent or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.JavaComponent + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.JavaComponent] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("JavaComponent", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + environment_name: str, + name: str, + java_component_envelope: Union[_models.JavaComponent, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(java_component_envelope, (IOBase, bytes)): + _content = java_component_envelope + else: + _json = self._serialize.body(java_component_envelope, "JavaComponent") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + java_component_envelope: _models.JavaComponent, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.JavaComponent]: + """Creates or updates a Java Component. + + Creates or updates a Java Component in a Managed Environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the Java Component. Required. + :type name: str + :param java_component_envelope: Configuration details of the Java Component. Required. + :type java_component_envelope: ~azure.mgmt.appcontainers.models.JavaComponent + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either JavaComponent or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.JavaComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + java_component_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.JavaComponent]: + """Creates or updates a Java Component. + + Creates or updates a Java Component in a Managed Environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the Java Component. Required. + :type name: str + :param java_component_envelope: Configuration details of the Java Component. Required. + :type java_component_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either JavaComponent or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.JavaComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + java_component_envelope: Union[_models.JavaComponent, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.JavaComponent]: + """Creates or updates a Java Component. + + Creates or updates a Java Component in a Managed Environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the Java Component. Required. + :type name: str + :param java_component_envelope: Configuration details of the Java Component. Is either a + JavaComponent type or a IO[bytes] type. Required. + :type java_component_envelope: ~azure.mgmt.appcontainers.models.JavaComponent or IO[bytes] + :return: An instance of LROPoller that returns either JavaComponent or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.JavaComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.JavaComponent] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + java_component_envelope=java_component_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("JavaComponent", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.JavaComponent].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.JavaComponent]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _update_initial( + self, + resource_group_name: str, + environment_name: str, + name: str, + java_component_envelope: Union[_models.JavaComponent, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(java_component_envelope, (IOBase, bytes)): + _content = java_component_envelope + else: + _json = self._serialize.body(java_component_envelope, "JavaComponent") + + _request = build_update_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + java_component_envelope: _models.JavaComponent, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.JavaComponent]: + """Update properties of a Java Component. + + Patches a Java Component using JSON Merge Patch. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the Java Component. Required. + :type name: str + :param java_component_envelope: Configuration details of the Java Component. Required. + :type java_component_envelope: ~azure.mgmt.appcontainers.models.JavaComponent + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either JavaComponent or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.JavaComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + java_component_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.JavaComponent]: + """Update properties of a Java Component. + + Patches a Java Component using JSON Merge Patch. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the Java Component. Required. + :type name: str + :param java_component_envelope: Configuration details of the Java Component. Required. + :type java_component_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either JavaComponent or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.JavaComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + java_component_envelope: Union[_models.JavaComponent, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.JavaComponent]: + """Update properties of a Java Component. + + Patches a Java Component using JSON Merge Patch. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the Java Component. Required. + :type name: str + :param java_component_envelope: Configuration details of the Java Component. Is either a + JavaComponent type or a IO[bytes] type. Required. + :type java_component_envelope: ~azure.mgmt.appcontainers.models.JavaComponent or IO[bytes] + :return: An instance of LROPoller that returns either JavaComponent or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.JavaComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.JavaComponent] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + java_component_envelope=java_component_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("JavaComponent", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.JavaComponent].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.JavaComponent]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, resource_group_name: str, environment_name: str, name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, resource_group_name: str, environment_name: str, name: str, **kwargs: Any + ) -> LROPoller[None]: + """Delete a Java Component. + + Delete a Java Component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the Java Component. Required. + :type name: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_jobs_executions_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_jobs_executions_operations.py index 2a817c4e35f7..cc7739b4cffd 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_jobs_executions_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_jobs_executions_operations.py @@ -27,7 +27,6 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -46,7 +45,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -55,7 +54,7 @@ def build_list_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/executions", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_jobs_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_jobs_operations.py index 823ccca2a63e..3d818980ddcc 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_jobs_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_jobs_operations.py @@ -32,7 +32,6 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -51,7 +50,7 @@ def build_list_detectors_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -60,7 +59,7 @@ def build_list_detectors_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/detectors", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -84,7 +83,7 @@ def build_get_detector_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -93,7 +92,7 @@ def build_get_detector_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/detectors/{detectorName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -118,7 +117,7 @@ def build_proxy_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -127,7 +126,7 @@ def build_proxy_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/detectorProperties/{apiName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -150,13 +149,13 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.App/jobs") path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -174,7 +173,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -183,7 +182,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -204,7 +203,7 @@ def build_get_request(resource_group_name: str, job_name: str, subscription_id: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -213,7 +212,7 @@ def build_get_request(resource_group_name: str, job_name: str, subscription_id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -237,7 +236,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -247,7 +246,7 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -271,7 +270,7 @@ def build_delete_request(resource_group_name: str, job_name: str, subscription_i _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -280,7 +279,7 @@ def build_delete_request(resource_group_name: str, job_name: str, subscription_i "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -302,7 +301,7 @@ def build_update_request(resource_group_name: str, job_name: str, subscription_i _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -312,7 +311,7 @@ def build_update_request(resource_group_name: str, job_name: str, subscription_i "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -336,7 +335,7 @@ def build_start_request(resource_group_name: str, job_name: str, subscription_id _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -346,7 +345,7 @@ def build_start_request(resource_group_name: str, job_name: str, subscription_id "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/start", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -372,7 +371,7 @@ def build_stop_execution_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -381,7 +380,7 @@ def build_stop_execution_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/executions/{jobExecutionName}/stop", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -408,7 +407,7 @@ def build_stop_multiple_executions_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -417,7 +416,7 @@ def build_stop_multiple_executions_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/stop", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -441,7 +440,7 @@ def build_list_secrets_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -450,7 +449,7 @@ def build_list_secrets_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/listSecrets", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -468,7 +467,69 @@ def build_list_secrets_request( return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -class JobsOperations: +def build_resume_request(resource_group_name: str, job_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/resume", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "jobName": _SERIALIZER.url("job_name", job_name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_suspend_request(resource_group_name: str, job_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/suspend", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "jobName": _SERIALIZER.url("job_name", job_name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class JobsOperations: # pylint: disable=too-many-public-methods """ .. warning:: **DO NOT** instantiate this class directly. @@ -636,7 +697,7 @@ def get_detector( @distributed_trace def proxy_get(self, resource_group_name: str, job_name: str, api_name: str, **kwargs: Any) -> _models.Job: - """Get the properties of a Container App Job. + """Get the properties for a given Container App Job. Get the properties of a Container App Job. @@ -1910,3 +1971,233 @@ def list_secrets(self, resource_group_name: str, job_name: str, **kwargs: Any) - return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore + + def _resume_initial(self, resource_group_name: str, job_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_resume_request( + resource_group_name=resource_group_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_resume(self, resource_group_name: str, job_name: str, **kwargs: Any) -> LROPoller[_models.Job]: + """Resumes a suspended job. + + Resumes a suspended job. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param job_name: Name of the Job. Required. + :type job_name: str + :return: An instance of LROPoller that returns either Job or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.Job] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Job] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._resume_initial( + resource_group_name=resource_group_name, + job_name=job_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Job", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.Job].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.Job](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _suspend_initial(self, resource_group_name: str, job_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_suspend_request( + resource_group_name=resource_group_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_suspend(self, resource_group_name: str, job_name: str, **kwargs: Any) -> LROPoller[_models.Job]: + """Suspends a job. + + Suspends a job. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param job_name: Name of the Job. Required. + :type job_name: str + :return: An instance of LROPoller that returns either Job or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.Job] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Job] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._suspend_initial( + resource_group_name=resource_group_name, + job_name=job_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Job", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.Job].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.Job](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_logic_apps_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_logic_apps_operations.py new file mode 100644 index 000000000000..d605e1b98115 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_logic_apps_operations.py @@ -0,0 +1,1074 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_get_request( + resource_group_name: str, container_app_name: str, logic_app_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/providers/Microsoft.App/logicApps/{logicAppName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "containerAppName": _SERIALIZER.url( + "container_app_name", container_app_name, "str", pattern=r"^[-\w\._\(\)]+$" + ), + "logicAppName": _SERIALIZER.url("logic_app_name", logic_app_name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, container_app_name: str, logic_app_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/providers/Microsoft.App/logicApps/{logicAppName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "containerAppName": _SERIALIZER.url( + "container_app_name", container_app_name, "str", pattern=r"^[-\w\._\(\)]+$" + ), + "logicAppName": _SERIALIZER.url("logic_app_name", logic_app_name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, container_app_name: str, logic_app_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/providers/Microsoft.App/logicApps/{logicAppName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "containerAppName": _SERIALIZER.url( + "container_app_name", container_app_name, "str", pattern=r"^[-\w\._\(\)]+$" + ), + "logicAppName": _SERIALIZER.url("logic_app_name", logic_app_name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_workflows_request( + resource_group_name: str, container_app_name: str, logic_app_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/providers/Microsoft.App/logicApps/{logicAppName}/workflows", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "containerAppName": _SERIALIZER.url( + "container_app_name", container_app_name, "str", pattern=r"^[-\w\._\(\)]+$" + ), + "logicAppName": _SERIALIZER.url("logic_app_name", logic_app_name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_workflow_request( + resource_group_name: str, + container_app_name: str, + logic_app_name: str, + workflow_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/providers/Microsoft.App/logicApps/{logicAppName}/workflows/{workflowName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "containerAppName": _SERIALIZER.url( + "container_app_name", container_app_name, "str", pattern=r"^[-\w\._\(\)]+$" + ), + "logicAppName": _SERIALIZER.url("logic_app_name", logic_app_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "workflowName": _SERIALIZER.url( + "workflow_name", workflow_name, "str", max_length=63, min_length=3, pattern=r"^[a-z][a-z0-9]*$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_deploy_workflow_artifacts_request( + resource_group_name: str, container_app_name: str, logic_app_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/providers/Microsoft.App/logicApps/{logicAppName}/deployWorkflowArtifacts", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "containerAppName": _SERIALIZER.url( + "container_app_name", container_app_name, "str", pattern=r"^[-\w\._\(\)]+$" + ), + "logicAppName": _SERIALIZER.url("logic_app_name", logic_app_name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_workflows_connections_request( + resource_group_name: str, container_app_name: str, logic_app_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/providers/Microsoft.App/logicApps/{logicAppName}/listWorkflowsConnections", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "containerAppName": _SERIALIZER.url( + "container_app_name", container_app_name, "str", pattern=r"^[-\w\._\(\)]+$" + ), + "logicAppName": _SERIALIZER.url("logic_app_name", logic_app_name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_invoke_request( + resource_group_name: str, + container_app_name: str, + logic_app_name: str, + subscription_id: str, + *, + x_ms_logic_apps_proxy_path: str, + x_ms_logic_apps_proxy_method: Union[str, _models.LogicAppsProxyMethod], + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/providers/Microsoft.App/logicApps/{logicAppName}/invoke", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "containerAppName": _SERIALIZER.url( + "container_app_name", container_app_name, "str", pattern=r"^[-\w\._\(\)]+$" + ), + "logicAppName": _SERIALIZER.url("logic_app_name", logic_app_name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["x-ms-logicApps-proxy-path"] = _SERIALIZER.header( + "x_ms_logic_apps_proxy_path", x_ms_logic_apps_proxy_path, "str" + ) + _headers["x-ms-logicApps-proxy-method"] = _SERIALIZER.header( + "x_ms_logic_apps_proxy_method", x_ms_logic_apps_proxy_method, "str" + ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class LogicAppsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s + :attr:`logic_apps` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get( + self, resource_group_name: str, container_app_name: str, logic_app_name: str, **kwargs: Any + ) -> _models.LogicApp: + """Gets a logic app extension resource. + + Gets a logic app extension resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param logic_app_name: Name of the Logic App, the extension resource. Required. + :type logic_app_name: str + :return: LogicApp or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.LogicApp + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.LogicApp] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + logic_app_name=logic_app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("LogicApp", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def create_or_update( + self, + resource_group_name: str, + container_app_name: str, + logic_app_name: str, + resource: _models.LogicApp, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.LogicApp: + """Create or update a Logic App extension resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param logic_app_name: Name of the Logic App, the extension resource. Required. + :type logic_app_name: str + :param resource: Logic app resource properties. Required. + :type resource: ~azure.mgmt.appcontainers.models.LogicApp + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: LogicApp or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.LogicApp + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + container_app_name: str, + logic_app_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.LogicApp: + """Create or update a Logic App extension resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param logic_app_name: Name of the Logic App, the extension resource. Required. + :type logic_app_name: str + :param resource: Logic app resource properties. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: LogicApp or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.LogicApp + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + container_app_name: str, + logic_app_name: str, + resource: Union[_models.LogicApp, IO[bytes]], + **kwargs: Any + ) -> _models.LogicApp: + """Create or update a Logic App extension resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param logic_app_name: Name of the Logic App, the extension resource. Required. + :type logic_app_name: str + :param resource: Logic app resource properties. Is either a LogicApp type or a IO[bytes] type. + Required. + :type resource: ~azure.mgmt.appcontainers.models.LogicApp or IO[bytes] + :return: LogicApp or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.LogicApp + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.LogicApp] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _json = self._serialize.body(resource, "LogicApp") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + logic_app_name=logic_app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("LogicApp", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, container_app_name: str, logic_app_name: str, **kwargs: Any + ) -> None: + """Deletes a Logic App extension resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param logic_app_name: Name of the Logic App, the extension resource. Required. + :type logic_app_name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + logic_app_name=logic_app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list_workflows( + self, resource_group_name: str, container_app_name: str, logic_app_name: str, **kwargs: Any + ) -> Iterable["_models.WorkflowEnvelope"]: + """List the workflows for a logic app. + + List the workflows for a logic app. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param logic_app_name: Name of the Logic App, the extension resource. Required. + :type logic_app_name: str + :return: An iterator like instance of either WorkflowEnvelope or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.WorkflowEnvelope] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.WorkflowEnvelopeCollection] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_workflows_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + logic_app_name=logic_app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("WorkflowEnvelopeCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get_workflow( + self, resource_group_name: str, container_app_name: str, logic_app_name: str, workflow_name: str, **kwargs: Any + ) -> _models.WorkflowEnvelope: + """Get workflow information by its name. + + Get workflow information by its name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param logic_app_name: Name of the Logic App, the extension resource. Required. + :type logic_app_name: str + :param workflow_name: Workflow name. Required. + :type workflow_name: str + :return: WorkflowEnvelope or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.WorkflowEnvelope + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.WorkflowEnvelope] = kwargs.pop("cls", None) + + _request = build_get_workflow_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + logic_app_name=logic_app_name, + workflow_name=workflow_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("WorkflowEnvelope", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def deploy_workflow_artifacts( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + container_app_name: str, + logic_app_name: str, + workflow_artifacts: Optional[_models.WorkflowArtifacts] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Creates or updates the artifacts for the logic app. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param logic_app_name: Name of the Logic App, the extension resource. Required. + :type logic_app_name: str + :param workflow_artifacts: Application settings and files of the workflow. Default value is + None. + :type workflow_artifacts: ~azure.mgmt.appcontainers.models.WorkflowArtifacts + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def deploy_workflow_artifacts( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + container_app_name: str, + logic_app_name: str, + workflow_artifacts: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Creates or updates the artifacts for the logic app. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param logic_app_name: Name of the Logic App, the extension resource. Required. + :type logic_app_name: str + :param workflow_artifacts: Application settings and files of the workflow. Default value is + None. + :type workflow_artifacts: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def deploy_workflow_artifacts( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + container_app_name: str, + logic_app_name: str, + workflow_artifacts: Optional[Union[_models.WorkflowArtifacts, IO[bytes]]] = None, + **kwargs: Any + ) -> None: + """Creates or updates the artifacts for the logic app. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param logic_app_name: Name of the Logic App, the extension resource. Required. + :type logic_app_name: str + :param workflow_artifacts: Application settings and files of the workflow. Is either a + WorkflowArtifacts type or a IO[bytes] type. Default value is None. + :type workflow_artifacts: ~azure.mgmt.appcontainers.models.WorkflowArtifacts or IO[bytes] + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(workflow_artifacts, (IOBase, bytes)): + _content = workflow_artifacts + else: + if workflow_artifacts is not None: + _json = self._serialize.body(workflow_artifacts, "WorkflowArtifacts") + else: + _json = None + + _request = build_deploy_workflow_artifacts_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + logic_app_name=logic_app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list_workflows_connections( + self, resource_group_name: str, container_app_name: str, logic_app_name: str, **kwargs: Any + ) -> _models.WorkflowEnvelope: + """Gets logic app's connections. + + Gets logic app's connections. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param logic_app_name: Name of the Logic App, the extension resource. Required. + :type logic_app_name: str + :return: WorkflowEnvelope or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.WorkflowEnvelope + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.WorkflowEnvelope] = kwargs.pop("cls", None) + + _request = build_list_workflows_connections_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + logic_app_name=logic_app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("WorkflowEnvelope", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def invoke( + self, + resource_group_name: str, + container_app_name: str, + logic_app_name: str, + x_ms_logic_apps_proxy_path: str, + x_ms_logic_apps_proxy_method: Union[str, _models.LogicAppsProxyMethod], + **kwargs: Any + ) -> JSON: + """Proxies a the API call to the logic app backed by the container app. + + Proxies a the API call to the logic app backed by the container app. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param container_app_name: Name of the Container App. Required. + :type container_app_name: str + :param logic_app_name: Name of the LogicApp App, the extension resource. Required. + :type logic_app_name: str + :param x_ms_logic_apps_proxy_path: The proxy path for the API call. Required. + :type x_ms_logic_apps_proxy_path: str + :param x_ms_logic_apps_proxy_method: The proxy method for the API call. Known values are: "GET" + and "POST". Required. + :type x_ms_logic_apps_proxy_method: str or + ~azure.mgmt.appcontainers.models.LogicAppsProxyMethod + :return: JSON or the result of cls(response) + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[JSON] = kwargs.pop("cls", None) + + _request = build_invoke_request( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + logic_app_name=logic_app_name, + subscription_id=self._config.subscription_id, + x_ms_logic_apps_proxy_path=x_ms_logic_apps_proxy_path, + x_ms_logic_apps_proxy_method=x_ms_logic_apps_proxy_method, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("object", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_certificates_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_certificates_operations.py index 3a1b2fd048f1..9f36dced20c6 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_certificates_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_certificates_operations.py @@ -32,7 +32,6 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -51,7 +50,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -60,7 +59,7 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/managedCertificates/{managedCertificateName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -85,7 +84,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -95,7 +94,7 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/managedCertificates/{managedCertificateName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -122,7 +121,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -131,7 +130,7 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/managedCertificates/{managedCertificateName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -156,7 +155,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -166,7 +165,7 @@ def build_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/managedCertificates/{managedCertificateName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -193,7 +192,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -202,7 +201,7 @@ def build_list_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/managedCertificates", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environment_diagnostics_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environment_diagnostics_operations.py index 28b2c8dd63f3..9dc1c93f419e 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environment_diagnostics_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environment_diagnostics_operations.py @@ -25,7 +25,6 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -44,7 +43,7 @@ def build_list_detectors_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -53,7 +52,7 @@ def build_list_detectors_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/detectors", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -77,7 +76,7 @@ def build_get_detector_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -86,7 +85,7 @@ def build_get_detector_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/detectors/{detectorName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environment_private_endpoint_connections_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environment_private_endpoint_connections_operations.py new file mode 100644 index 000000000000..bc2a1b0afbbd --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environment_private_endpoint_connections_operations.py @@ -0,0 +1,710 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_request( + resource_group_name: str, environment_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/privateEndpointConnections", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "environmentName": _SERIALIZER.url("environment_name", environment_name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, + environment_name: str, + private_endpoint_connection_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "environmentName": _SERIALIZER.url("environment_name", environment_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, + environment_name: str, + private_endpoint_connection_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "environmentName": _SERIALIZER.url("environment_name", environment_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, + environment_name: str, + private_endpoint_connection_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "environmentName": _SERIALIZER.url("environment_name", environment_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class ManagedEnvironmentPrivateEndpointConnectionsOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s + :attr:`managed_environment_private_endpoint_connections` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, resource_group_name: str, environment_name: str, **kwargs: Any + ) -> Iterable["_models.PrivateEndpointConnection"]: + """List private endpoint connections for a given managed environment. + + List private endpoint connections for a given managed environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :return: An iterator like instance of either PrivateEndpointConnection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get( + self, resource_group_name: str, environment_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Get a private endpoint connection for a given managed environment. + + Get a private endpoint connection for a given managed environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. Required. + :type private_endpoint_connection_name: str + :return: PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + environment_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection_envelope: Union[_models.PrivateEndpointConnection, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(private_endpoint_connection_envelope, (IOBase, bytes)): + _content = private_endpoint_connection_envelope + else: + _json = self._serialize.body(private_endpoint_connection_envelope, "PrivateEndpointConnection") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + environment_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection_envelope: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PrivateEndpointConnection]: + """Update the state of a private endpoint connection for a given managed environment. + + Update the state of a private endpoint connection for a given managed environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. Required. + :type private_endpoint_connection_name: str + :param private_endpoint_connection_envelope: The resource of private endpoint and its + properties. Required. + :type private_endpoint_connection_envelope: + ~azure.mgmt.appcontainers.models.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + environment_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PrivateEndpointConnection]: + """Update the state of a private endpoint connection for a given managed environment. + + Update the state of a private endpoint connection for a given managed environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. Required. + :type private_endpoint_connection_name: str + :param private_endpoint_connection_envelope: The resource of private endpoint and its + properties. Required. + :type private_endpoint_connection_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + environment_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection_envelope: Union[_models.PrivateEndpointConnection, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.PrivateEndpointConnection]: + """Update the state of a private endpoint connection for a given managed environment. + + Update the state of a private endpoint connection for a given managed environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. Required. + :type private_endpoint_connection_name: str + :param private_endpoint_connection_envelope: The resource of private endpoint and its + properties. Is either a PrivateEndpointConnection type or a IO[bytes] type. Required. + :type private_endpoint_connection_envelope: + ~azure.mgmt.appcontainers.models.PrivateEndpointConnection or IO[bytes] + :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + environment_name=environment_name, + private_endpoint_connection_name=private_endpoint_connection_name, + private_endpoint_connection_envelope=private_endpoint_connection_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.PrivateEndpointConnection].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.PrivateEndpointConnection]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, resource_group_name: str, environment_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, resource_group_name: str, environment_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Delete a private endpoint connection for a given managed environment. + + Delete a private endpoint connection for a given managed environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. Required. + :type private_endpoint_connection_name: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + environment_name=environment_name, + private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environment_private_link_resources_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environment_private_link_resources_operations.py new file mode 100644 index 000000000000..b0e3381efafc --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environment_private_link_resources_operations.py @@ -0,0 +1,178 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_request( + resource_group_name: str, environment_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/privateLinkResources", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "environmentName": _SERIALIZER.url("environment_name", environment_name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class ManagedEnvironmentPrivateLinkResourcesOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s + :attr:`managed_environment_private_link_resources` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, resource_group_name: str, environment_name: str, **kwargs: Any + ) -> Iterable["_models.PrivateLinkResource"]: + """List private link resources for a given managed environment. + + List private link resources for a given managed environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :return: An iterator like instance of either PrivateLinkResource or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.PrivateLinkResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environment_usages_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environment_usages_operations.py index 3cb052f8ef03..1a5c2012b781 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environment_usages_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environment_usages_operations.py @@ -27,7 +27,6 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -46,7 +45,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -55,7 +54,7 @@ def build_list_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/usages", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environments_diagnostics_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environments_diagnostics_operations.py index b5b544b084fb..3fc779e575d5 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environments_diagnostics_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environments_diagnostics_operations.py @@ -25,7 +25,6 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -44,7 +43,7 @@ def build_get_root_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -53,7 +52,7 @@ def build_get_root_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/detectorProperties/rootApi/", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environments_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environments_operations.py index eb2d6a401338..7a8ce01af66d 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environments_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environments_operations.py @@ -32,7 +32,6 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -49,13 +48,13 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.App/managedEnvironments") path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -73,7 +72,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -82,7 +81,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -105,7 +104,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -114,7 +113,7 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -138,7 +137,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -148,7 +147,7 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -174,7 +173,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -183,7 +182,7 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -207,7 +206,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -217,7 +216,7 @@ def build_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -243,7 +242,7 @@ def build_get_auth_token_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -252,7 +251,7 @@ def build_get_auth_token_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/getAuthtoken", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -276,7 +275,7 @@ def build_list_workload_profile_states_request( # pylint: disable=name-too-long _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -285,7 +284,7 @@ def build_list_workload_profile_states_request( # pylint: disable=name-too-long "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/workloadProfileStates", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environments_storages_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environments_storages_operations.py index cb9e48e718de..03461d39e5b0 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environments_storages_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environments_storages_operations.py @@ -26,7 +26,6 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -45,7 +44,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -54,7 +53,7 @@ def build_list_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/storages", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -78,7 +77,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -87,7 +86,7 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/storages/{storageName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -112,7 +111,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -122,7 +121,7 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/storages/{storageName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -149,7 +148,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -158,7 +157,7 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/storages/{storageName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_namespaces_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_namespaces_operations.py index 0f1cef41dd13..fc3bcc72ea79 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_namespaces_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_namespaces_operations.py @@ -26,7 +26,6 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -45,7 +44,7 @@ def build_check_name_availability_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -55,7 +54,7 @@ def build_check_name_availability_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/checkNameAvailability", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_operations.py index c0abef6f27ab..2a59bde3b989 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_operations.py @@ -27,7 +27,6 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -44,7 +43,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_usages_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_usages_operations.py index a99b84cddefe..d5a93c241b48 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_usages_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_usages_operations.py @@ -27,7 +27,6 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import ContainerAppsAPIClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -44,7 +43,7 @@ def build_list_request(location: str, subscription_id: str, **kwargs: Any) -> Ht _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -53,7 +52,7 @@ def build_list_request(location: str, subscription_id: str, **kwargs: Any) -> Ht ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str", pattern=r"^[-\w\._]+$"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_create_or_update.py new file mode 100644 index 000000000000..5a7c362d5592 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_create_or_update.py @@ -0,0 +1,61 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python app_resiliency_create_or_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + response = client.app_resiliency.create_or_update( + resource_group_name="rg", + app_name="testcontainerApp0", + name="resiliency-policy-1", + resiliency_envelope={ + "properties": { + "circuitBreakerPolicy": {"consecutiveErrors": 5, "intervalInSeconds": 10, "maxEjectionPercent": 50}, + "httpConnectionPool": {"http1MaxPendingRequests": 1024, "http2MaxRequests": 1024}, + "httpRetryPolicy": { + "matches": { + "errors": ["5xx", "connect-failure", "reset", "retriable-headers", "retriable-status-codes"], + "headers": [{"header": "X-Content-Type", "match": {"prefixMatch": "GOATS"}}], + "httpStatusCodes": [502, 503], + }, + "maxRetries": 5, + "retryBackOff": {"initialDelayInMilliseconds": 1000, "maxIntervalInMilliseconds": 10000}, + }, + "tcpConnectionPool": {"maxConnections": 100}, + "tcpRetryPolicy": {"maxConnectAttempts": 3}, + "timeoutPolicy": {"connectionTimeoutInSeconds": 5, "responseTimeoutInSeconds": 15}, + } + }, + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/AppResiliency_CreateOrUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_delete.py new file mode 100644 index 000000000000..2a3290b3c7b3 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_delete.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python app_resiliency_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + client.app_resiliency.delete( + resource_group_name="rg", + app_name="testcontainerApp0", + name="resiliency-policy-1", + ) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/AppResiliency_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_get.py new file mode 100644 index 000000000000..7065799318f7 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_get.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python app_resiliency_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + response = client.app_resiliency.get( + resource_group_name="rg", + app_name="testcontainerApp0", + name="resiliency-policy-1", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/AppResiliency_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_list.py new file mode 100644 index 000000000000..f6775fa9fb55 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_list.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python app_resiliency_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + response = client.app_resiliency.list( + resource_group_name="rg", + app_name="testcontainerApp0", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/AppResiliency_List.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_patch.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_patch.py new file mode 100644 index 000000000000..7098bc5e8eb5 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_patch.py @@ -0,0 +1,46 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python app_resiliency_patch.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + response = client.app_resiliency.update( + resource_group_name="rg", + app_name="testcontainerApp0", + name="resiliency-policy-1", + resiliency_envelope={ + "properties": {"timeoutPolicy": {"connectionTimeoutInSeconds": 40, "responseTimeoutInSeconds": 30}} + }, + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/AppResiliency_Patch.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/auth_configs_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/auth_configs_create_or_update.py index 624220b47933..c71fdb6e4cdd 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/auth_configs_create_or_update.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/auth_configs_create_or_update.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appcontainers import ContainerAppsAPIClient @@ -53,6 +51,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/AuthConfigs_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/AuthConfigs_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/auth_configs_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/auth_configs_delete.py index ba040bbd2aa2..8240d4e413a7 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/auth_configs_delete.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/auth_configs_delete.py @@ -37,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/AuthConfigs_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/AuthConfigs_Delete.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/auth_configs_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/auth_configs_get.py index 3938c1cbfe61..4c69273b19ca 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/auth_configs_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/auth_configs_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/AuthConfigs_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/AuthConfigs_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/auth_configs_list_by_container.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/auth_configs_list_by_container.py index 5e68fc393e08..dd0e21b2cdfb 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/auth_configs_list_by_container.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/auth_configs_list_by_container.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/AuthConfigs_ListByContainer.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/AuthConfigs_ListByContainer.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/available_workload_profiles_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/available_workload_profiles_get.py index 983b5fa9ee20..32d0a6b0f796 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/available_workload_profiles_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/available_workload_profiles_get.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/AvailableWorkloadProfiles_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/AvailableWorkloadProfiles_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/billing_meters_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/billing_meters_get.py index a0d779a0e42b..80c67d53ed01 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/billing_meters_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/billing_meters_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/BillingMeters_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/BillingMeters_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_create_or_update.py new file mode 100644 index 000000000000..04594ac45949 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_create_or_update.py @@ -0,0 +1,65 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python builders_create_or_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.builders.begin_create_or_update( + resource_group_name="rg", + builder_name="testBuilder", + builder_envelope={ + "identity": { + "type": "SystemAssigned,UserAssigned", + "userAssignedIdentities": { + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity1": {} + }, + }, + "location": "eastus", + "properties": { + "containerRegistries": [ + { + "containerRegistryServer": "test.azurecr.io", + "identityResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity1", + }, + { + "containerRegistryServer": "test2.azurecr.io", + "identityResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity1", + }, + ], + "environmentId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg/providers/Microsoft.App/managedEnvironments/testEnv", + }, + "tags": {"company": "Microsoft"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Builders_CreateOrUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_delete.py new file mode 100644 index 000000000000..259406317a14 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_delete.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python builders_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + client.builders.begin_delete( + resource_group_name="rg", + builder_name="testBuilder", + ).result() + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Builders_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_get.py new file mode 100644 index 000000000000..e2321d5c4a71 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_get.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python builders_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.builders.get( + resource_group_name="rg", + builder_name="testBuilder", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Builders_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_list_by_resource_group.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_list_by_resource_group.py new file mode 100644 index 000000000000..2cdceb481671 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_list_by_resource_group.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python builders_list_by_resource_group.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.builders.list_by_resource_group( + resource_group_name="rg", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Builders_ListByResourceGroup.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_list_by_subscription.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_list_by_subscription.py new file mode 100644 index 000000000000..13608b9d4dff --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_list_by_subscription.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python builders_list_by_subscription.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.builders.list_by_subscription() + for item in response: + print(item) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Builders_ListBySubscription.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_update.py new file mode 100644 index 000000000000..0d01c2a2e546 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_update.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python builders_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.builders.begin_update( + resource_group_name="rg", + builder_name="testBuilder", + builder_envelope={"tags": {"mytag1": "myvalue1"}}, + ).result() + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Builders_Update.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_create_or_update.py new file mode 100644 index 000000000000..ae6655d27d86 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_create_or_update.py @@ -0,0 +1,70 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python builds_create_or_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.builds.begin_create_or_update( + resource_group_name="rg", + builder_name="testBuilder", + build_name="testBuild-123456789az", + build_envelope={ + "properties": { + "configuration": { + "baseOs": "DebianBullseye", + "environmentVariables": [{"name": "foo1", "value": "bar1"}, {"name": "foo2", "value": "bar2"}], + "platform": "dotnetcore", + "platformVersion": "7.0", + "preBuildSteps": [ + { + "description": "First pre build step.", + "httpGet": { + "fileName": "output.txt", + "headers": ["foo", "bar"], + "url": "https://microsoft.com", + }, + "scripts": ["echo 'hello'", "echo 'world'"], + }, + { + "description": "Second pre build step.", + "httpGet": {"fileName": "output.txt", "headers": ["foo"], "url": "https://microsoft.com"}, + "scripts": ["echo 'hello'", "echo 'again'"], + }, + ], + }, + "destinationContainerRegistry": {"image": "test.azurecr.io/repo:tag", "server": "test.azurecr.io"}, + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Builds_CreateOrUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_delete.py new file mode 100644 index 000000000000..67b8f63959d6 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_delete.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python builds_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + client.builds.begin_delete( + resource_group_name="rg", + builder_name="testBuilder", + build_name="testBuild", + ).result() + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Builds_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_get.py new file mode 100644 index 000000000000..2148675026f8 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_get.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python builds_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.builds.get( + resource_group_name="rg", + builder_name="testBuilder", + build_name="testBuild", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Builds_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_list_auth_token.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_list_auth_token.py new file mode 100644 index 000000000000..f66fd8c88ea5 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_list_auth_token.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python builds_list_auth_token.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.build_auth_token.list( + resource_group_name="rg", + builder_name="testBuilder", + build_name="testBuild", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Builds_ListAuthToken.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_list_by_builder_resource.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_list_by_builder_resource.py new file mode 100644 index 000000000000..cc345a50860d --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_list_by_builder_resource.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python builds_list_by_builder_resource.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.builds_by_builder_resource.list( + resource_group_name="rg", + builder_name="testBuilder", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Builds_ListByBuilderResource.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_create_or_update.py index dff91853c9ea..594148a497b8 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_create_or_update.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_create_or_update.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Certificate_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Certificate_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_create_or_update_from_key_vault.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_create_or_update_from_key_vault.py new file mode 100644 index 000000000000..ef33b0ce76c3 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_create_or_update_from_key_vault.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python certificate_create_or_update_from_key_vault.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + response = client.certificates.create_or_update( + resource_group_name="examplerg", + environment_name="testcontainerenv", + certificate_name="certificate-firendly-name", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Certificate_CreateOrUpdate_FromKeyVault.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_delete.py index 90bd4a513ede..f23ff120a400 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_delete.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_delete.py @@ -37,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Certificate_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Certificate_Delete.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_get.py index 5dcc3680dfa2..0828c12aa00b 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Certificate_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Certificate_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificates_check_name_availability.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificates_check_name_availability.py index 54c16c926ef1..05ff56b14ce6 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificates_check_name_availability.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificates_check_name_availability.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appcontainers import ContainerAppsAPIClient @@ -43,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Certificates_CheckNameAvailability.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Certificates_CheckNameAvailability.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificates_list_by_managed_environment.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificates_list_by_managed_environment.py index 2cc236f9fce0..91be5df081a0 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificates_list_by_managed_environment.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificates_list_by_managed_environment.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Certificates_ListByManagedEnvironment.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Certificates_ListByManagedEnvironment.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificates_patch.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificates_patch.py index d89bae1c7fdb..bb11fd7d3044 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificates_patch.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificates_patch.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appcontainers import ContainerAppsAPIClient @@ -41,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Certificates_Patch.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Certificates_Patch.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificate_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificate_create_or_update.py index cdca5d34c027..da89a8a2733e 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ConnectedEnvironmentsCertificate_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ConnectedEnvironmentsCertificate_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificate_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificate_delete.py index 00f1ab1a0b5e..bb43e5e857eb 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 @@ -37,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ConnectedEnvironmentsCertificate_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ConnectedEnvironmentsCertificate_Delete.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificate_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificate_get.py index ace6d53f08b0..86116532731b 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificate_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificate_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ConnectedEnvironmentsCertificate_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ConnectedEnvironmentsCertificate_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificates_check_name_availability.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificates_check_name_availability.py index f22d461dea7c..6a53577f801c 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificates_check_name_availability.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificates_check_name_availability.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appcontainers import ContainerAppsAPIClient @@ -43,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ConnectedEnvironmentsCertificates_CheckNameAvailability.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ConnectedEnvironmentsCertificates_CheckNameAvailability.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificates_list_by_connected_environment.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificates_list_by_connected_environment.py index 913aa57949a6..1e7beb90acf6 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificates_list_by_connected_environment.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificates_list_by_connected_environment.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ConnectedEnvironmentsCertificates_ListByConnectedEnvironment.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ConnectedEnvironmentsCertificates_ListByConnectedEnvironment.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificates_patch.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificates_patch.py index 84aa2d9796cb..18e1b105e2e8 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificates_patch.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificates_patch.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appcontainers import ContainerAppsAPIClient @@ -41,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ConnectedEnvironmentsCertificates_Patch.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ConnectedEnvironmentsCertificates_Patch.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_create_or_update.py index 0d2ee04d43ae..24727ed167a4 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_create_or_update.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_create_or_update.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appcontainers import ContainerAppsAPIClient @@ -51,6 +49,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ConnectedEnvironments_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ConnectedEnvironments_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_dapr_components_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_dapr_components_create_or_update.py index 8e001608e83c..d9b1da9ab451 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_dapr_components_create_or_update.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_dapr_components_create_or_update.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appcontainers import ContainerAppsAPIClient @@ -49,6 +47,13 @@ def main(): ], "scopes": ["container-app-1", "container-app-2"], "secrets": [{"name": "masterkey", "value": "keyvalue"}], + "serviceComponentBind": [ + { + "metadata": {"name": "daprcomponentBind", "value": "redis-bind"}, + "name": "statestore", + "serviceId": "/subscriptions/9f7371f1-b593-4c3c-84e2-9167806ad358/resourceGroups/ca-syn2-group/providers/Microsoft.App/containerapps/cappredis", + } + ], "version": "v1", } }, @@ -56,6 +61,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ConnectedEnvironmentsDaprComponents_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ConnectedEnvironmentsDaprComponents_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_dapr_components_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_dapr_components_delete.py index 929cc80cc978..76733621cead 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 @@ -37,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ConnectedEnvironmentsDaprComponents_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ConnectedEnvironmentsDaprComponents_Delete.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_dapr_components_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_dapr_components_get.py index d6f1966fd4bf..b3dbdff17128 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_dapr_components_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_dapr_components_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ConnectedEnvironmentsDaprComponents_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ConnectedEnvironmentsDaprComponents_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_dapr_components_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_dapr_components_list.py index 6a55a4e1d8a0..dc4e642bcea1 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_dapr_components_list.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_dapr_components_list.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ConnectedEnvironmentsDaprComponents_List.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ConnectedEnvironmentsDaprComponents_List.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_dapr_components_list_secrets.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_dapr_components_list_secrets.py index 6df6c3e05174..10a102b48849 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_dapr_components_list_secrets.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_dapr_components_list_secrets.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ConnectedEnvironmentsDaprComponents_ListSecrets.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ConnectedEnvironmentsDaprComponents_ListSecrets.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_delete.py index e73072b39b27..b6b488e37f47 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_delete.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_delete.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ConnectedEnvironments_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ConnectedEnvironments_Delete.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_get.py index 313b7128c547..ae85090e64f1 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ConnectedEnvironments_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ConnectedEnvironments_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_list_by_resource_group.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_list_by_resource_group.py index ed8b13df7429..91340e4d4d70 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_list_by_resource_group.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_list_by_resource_group.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ConnectedEnvironments_ListByResourceGroup.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ConnectedEnvironments_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_list_by_subscription.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_list_by_subscription.py index ede57b26a655..ffe41e43b870 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_list_by_subscription.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_list_by_subscription.py @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ConnectedEnvironments_ListBySubscription.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ConnectedEnvironments_ListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_patch.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_patch.py index 5f8bdb48eaf5..9392818cb7a2 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_patch.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_patch.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ConnectedEnvironments_Patch.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ConnectedEnvironments_Patch.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_storages_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_storages_create_or_update.py index d9472452801e..094e1d0ce1a1 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_storages_create_or_update.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_storages_create_or_update.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appcontainers import ContainerAppsAPIClient @@ -50,6 +48,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ConnectedEnvironmentsStorages_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ConnectedEnvironmentsStorages_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_storages_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_storages_delete.py index 9f302e2a539c..05d1bf87a369 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 @@ -37,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ConnectedEnvironmentsStorages_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ConnectedEnvironmentsStorages_Delete.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_storages_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_storages_get.py index 0385ae553809..391eec19758c 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_storages_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_storages_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ConnectedEnvironmentsStorages_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ConnectedEnvironmentsStorages_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_storages_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_storages_list.py index 5f3b4f472f24..c73dc0806d5a 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_storages_list.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_storages_list.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ConnectedEnvironmentsStorages_List.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ConnectedEnvironmentsStorages_List.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_builds_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_builds_delete.py new file mode 100644 index 000000000000..1a7c4db19768 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_builds_delete.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python container_apps_builds_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + client.container_apps_builds.begin_delete( + resource_group_name="rg", + container_app_name="testCapp", + build_name="testBuild", + ).result() + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ContainerAppsBuilds_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_builds_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_builds_get.py new file mode 100644 index 000000000000..a1d2cf259996 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_builds_get.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python container_apps_builds_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.container_apps_builds.get( + resource_group_name="rg", + container_app_name="testCapp", + build_name="testBuild", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ContainerAppsBuilds_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_builds_list_by_container_app.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_builds_list_by_container_app.py new file mode 100644 index 000000000000..c9c0d99d4e1f --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_builds_list_by_container_app.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python container_apps_builds_list_by_container_app.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.container_apps_builds_by_container_app.list( + resource_group_name="rg", + container_app_name="testCapp", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ContainerAppsBuilds_ListByContainerApp.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_check_name_availability.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_check_name_availability.py index 6e2cdf2b61b5..c39bd4f29d8d 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_check_name_availability.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_check_name_availability.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appcontainers import ContainerAppsAPIClient @@ -40,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ContainerApps_CheckNameAvailability.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ContainerApps_CheckNameAvailability.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_create_or_update.py index 22d752c240f7..1ad3f2c2c0ab 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_create_or_update.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_create_or_update.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appcontainers import ContainerAppsAPIClient @@ -34,8 +32,14 @@ def main(): response = client.container_apps.begin_create_or_update( resource_group_name="rg", - container_app_name="testcontainerapp0", + container_app_name="testcontainerApp0", container_app_envelope={ + "identity": { + "type": "SystemAssigned,UserAssigned", + "userAssignedIdentities": { + "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourcegroups/rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myidentity": {} + }, + }, "location": "East US", "properties": { "configuration": { @@ -48,6 +52,13 @@ def main(): "httpReadBufferSize": 30, "logLevel": "debug", }, + "identitySettings": [ + { + "identity": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourcegroups/rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myidentity", + "lifecycle": "All", + }, + {"identity": "system", "lifecycle": "Init"}, + ], "ingress": { "additionalPortMappings": [ {"external": True, "targetPort": 1234}, @@ -91,17 +102,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": { + "dotnet": {"autoConfigureDataProtection": True}, + "java": { + "enableMetrics": True, + "javaAgent": { + "enabled": True, + "logging": { + "loggerSettings": [{"level": "debug", "logger": "org.springframework.boot"}] + }, + }, + }, + }, "service": {"type": "redis"}, }, "environmentId": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube", "template": { "containers": [ { - "image": "repo/testcontainerapp0:v1", - "name": "testcontainerapp0", + "image": "repo/testcontainerApp0:v1", + "name": "testcontainerApp0", "probes": [ { "httpGet": { @@ -114,33 +137,66 @@ def main(): "type": "Liveness", } ], + "volumeMounts": [ + {"mountPath": "/mnt/path1", "subPath": "subPath1", "volumeName": "azurefile"}, + {"mountPath": "/mnt/path2", "subPath": "subPath2", "volumeName": "nfsazurefile"}, + ], } ], "initContainers": [ { "args": ["-c", "while true; do echo hello; sleep 10;done"], "command": ["/bin/sh"], - "image": "repo/testcontainerapp0:v4", + "image": "repo/testcontainerApp0:v4", "name": "testinitcontainerApp0", - "resources": {"cpu": 0.5, "memory": "1Gi"}, + "resources": {"cpu": 0.2, "memory": "100Mi"}, } ], "scale": { + "cooldownPeriod": 350, "maxReplicas": 5, "minReplicas": 1, + "pollingInterval": 35, "rules": [ { "custom": {"metadata": {"concurrentRequests": "50"}, "type": "http"}, "name": "httpscalingrule", - } + }, + { + "custom": { + "identity": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourcegroups/rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myidentity", + "metadata": { + "messageCount": "5", + "namespace": "mynamespace", + "queueName": "myqueue", + }, + "type": "azure-servicebus", + }, + "name": "servicebus", + }, + { + "azureQueue": { + "accountName": "account1", + "identity": "system", + "queueLength": 1, + "queueName": "queue1", + }, + "name": "azure-queue", + }, ], }, "serviceBinds": [ { + "clientType": "dotnet", + "customizedKeys": {"DesiredKey": "defaultKey"}, "name": "redisService", "serviceId": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/containerApps/redisService", } ], + "volumes": [ + {"name": "azurefile", "storageName": "storage", "storageType": "AzureFile"}, + {"name": "nfsazurefile", "storageName": "nfsStorage", "storageType": "NfsAzureFile"}, + ], }, "workloadProfileName": "My-GP-01", }, @@ -149,6 +205,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ContainerApps_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ContainerApps_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_create_or_update_connected_environment.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_create_or_update_connected_environment.py new file mode 100644 index 000000000000..982c44339883 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_create_or_update_connected_environment.py @@ -0,0 +1,162 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, + "runtime": { + "dotnet": {"autoConfigureDataProtection": True}, + "java": { + "enableMetrics": True, + "javaAgent": { + "enabled": True, + "logging": { + "loggerSettings": [{"level": "debug", "logger": "org.springframework.boot"}] + }, + }, + }, + }, + }, + "environmentId": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/connectedEnvironments/demokube", + "template": { + "containers": [ + { + "image": "repo/testcontainerApp0:v1", + "name": "testcontainerApp0", + "probes": [ + { + "httpGet": { + "httpHeaders": [{"name": "Custom-Header", "value": "Awesome"}], + "path": "/health", + "port": 8080, + }, + "initialDelaySeconds": 3, + "periodSeconds": 3, + "type": "Liveness", + } + ], + } + ], + "initContainers": [ + { + "args": ["-c", "while true; do echo hello; sleep 10;done"], + "command": ["/bin/sh"], + "image": "repo/testcontainerApp0:v4", + "name": "testinitcontainerApp0", + "resources": {"cpu": 0.2, "memory": "100Mi"}, + } + ], + "scale": { + "cooldownPeriod": 350, + "maxReplicas": 5, + "minReplicas": 1, + "pollingInterval": 35, + "rules": [ + { + "custom": {"metadata": {"concurrentRequests": "50"}, "type": "http"}, + "name": "httpscalingrule", + } + ], + }, + }, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ContainerApps_CreateOrUpdate_ConnectedEnvironment.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_delete.py index 5584e089d51f..be555431bf19 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_delete.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_delete.py @@ -32,10 +32,10 @@ def main(): client.container_apps.begin_delete( resource_group_name="rg", - container_app_name="testworkerapp0", + container_app_name="testWorkerApp0", ).result() -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ContainerApps_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ContainerApps_Delete.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_diagnostics_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_diagnostics_get.py index d930996c61b2..6a6cba62774f 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_diagnostics_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_diagnostics_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ContainerAppsDiagnostics_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ContainerAppsDiagnostics_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_diagnostics_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_diagnostics_list.py index 76593271c57f..44e30c8edd2c 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_diagnostics_list.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_diagnostics_list.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ContainerAppsDiagnostics_List.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ContainerAppsDiagnostics_List.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_get.py index 90c811ae2ed6..f5f2cf370cd5 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_get.py @@ -32,11 +32,11 @@ def main(): response = client.container_apps_diagnostics.get_root( resource_group_name="rg", - container_app_name="testcontainerapp0", + container_app_name="testcontainerApp0", ) print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ContainerApps_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ContainerApps_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_get_auth_token.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_get_auth_token.py index ccc19d0b27a3..42aaf1991bc1 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_get_auth_token.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_get_auth_token.py @@ -32,11 +32,11 @@ def main(): response = client.container_apps.get_auth_token( resource_group_name="rg", - container_app_name="testcontainerapp0", + container_app_name="testcontainerApp0", ) print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ContainerApps_GetAuthToken.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ContainerApps_GetAuthToken.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_kind_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_kind_create_or_update.py new file mode 100644 index 000000000000..0710f88d9a99 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_kind_create_or_update.py @@ -0,0 +1,64 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python container_apps_kind_create_or_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.container_apps.begin_create_or_update( + resource_group_name="rg", + container_app_name="testcontainerAppKind", + container_app_envelope={ + "kind": "workflowapp", + "location": "East Us", + "managedBy": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg/providers/Microsoft.Web/sites/testcontainerAppKind", + "properties": { + "configuration": { + "activeRevisionsMode": "Single", + "ingress": {"allowInsecure": True, "external": True, "targetPort": 80}, + }, + "managedEnvironmentId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/testmanagedenv3", + "template": { + "containers": [ + { + "image": "default/logicapps-base:latest", + "name": "logicapps-container", + "resources": {"cpu": 1, "memory": "2.0Gi"}, + } + ], + "scale": {"cooldownPeriod": 350, "maxReplicas": 30, "minReplicas": 1, "pollingInterval": 35}, + }, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ContainerApps_Kind_CreateOrUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_list_by_resource_group.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_list_by_resource_group.py index 046c42b04668..1bc694dc2101 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_list_by_resource_group.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_list_by_resource_group.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ContainerApps_ListByResourceGroup.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ContainerApps_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_list_by_subscription.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_list_by_subscription.py index 0c3297623ffb..eca4c3765a5a 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_list_by_subscription.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_list_by_subscription.py @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ContainerApps_ListBySubscription.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ContainerApps_ListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_list_custom_host_name_analysis.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_list_custom_host_name_analysis.py index 658867e94928..f057938529c9 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_list_custom_host_name_analysis.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_list_custom_host_name_analysis.py @@ -32,11 +32,11 @@ def main(): response = client.container_apps.list_custom_host_name_analysis( resource_group_name="rg", - container_app_name="testcontainerapp0", + container_app_name="testcontainerApp0", ) print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ContainerApps_ListCustomHostNameAnalysis.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ContainerApps_ListCustomHostNameAnalysis.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_list_secrets.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_list_secrets.py index 2f46811b10e5..b06c04f37800 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_list_secrets.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_list_secrets.py @@ -32,11 +32,11 @@ def main(): response = client.container_apps.list_secrets( resource_group_name="rg", - container_app_name="testcontainerapp0", + container_app_name="testcontainerApp0", ) print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ContainerApps_ListSecrets.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ContainerApps_ListSecrets.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_managed_by_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_managed_by_create_or_update.py index 3888d2106624..0567ceee69bc 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_managed_by_create_or_update.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_managed_by_create_or_update.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appcontainers import ContainerAppsAPIClient @@ -34,7 +32,7 @@ def main(): response = client.container_apps.begin_create_or_update( resource_group_name="rg", - container_app_name="testcontainerappmanagedby", + container_app_name="testcontainerAppManagedBy", container_app_envelope={ "location": "East US", "managedBy": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.AppPlatform/Spring/springapp", @@ -44,7 +42,7 @@ def main(): "exposedPort": 4000, "external": True, "targetPort": 3000, - "traffic": [{"revisionName": "testcontainerappmanagedby-ab1234", "weight": 100}], + "traffic": [{"revisionName": "testcontainerAppManagedBy-ab1234", "weight": 100}], "transport": "tcp", } }, @@ -52,8 +50,8 @@ def main(): "template": { "containers": [ { - "image": "repo/testcontainerappmanagedby:v1", - "name": "testcontainerappmanagedby", + "image": "repo/testcontainerAppManagedBy:v1", + "name": "testcontainerAppManagedBy", "probes": [ { "initialDelaySeconds": 3, @@ -65,8 +63,10 @@ def main(): } ], "scale": { + "cooldownPeriod": 350, "maxReplicas": 5, "minReplicas": 1, + "pollingInterval": 35, "rules": [{"name": "tcpscalingrule", "tcp": {"metadata": {"concurrentConnections": "50"}}}], }, }, @@ -76,6 +76,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ContainerApps_ManagedBy_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ContainerApps_ManagedBy_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_patch.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_patch.py index 8e098ca5d753..614ee5f6f01e 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_patch.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_patch.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appcontainers import ContainerAppsAPIClient @@ -34,7 +32,7 @@ def main(): response = client.container_apps.begin_update( resource_group_name="rg", - container_app_name="testcontainerapp0", + container_app_name="testcontainerApp0", container_app_envelope={ "location": "East US", "properties": { @@ -78,16 +76,28 @@ 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": { + "dotnet": {"autoConfigureDataProtection": True}, + "java": { + "enableMetrics": True, + "javaAgent": { + "enabled": True, + "logging": { + "loggerSettings": [{"level": "debug", "logger": "org.springframework.boot"}] + }, + }, + }, + }, "service": {"type": "redis"}, }, "template": { "containers": [ { - "image": "repo/testcontainerapp0:v1", - "name": "testcontainerapp0", + "image": "repo/testcontainerApp0:v1", + "name": "testcontainerApp0", "probes": [ { "httpGet": { @@ -104,14 +114,16 @@ def main(): ], "initContainers": [ { - "image": "repo/testcontainerapp0:v4", + "image": "repo/testcontainerApp0:v4", "name": "testinitcontainerApp0", - "resources": {"cpu": 0.5, "memory": "1Gi"}, + "resources": {"cpu": 0.2, "memory": "100Mi"}, } ], "scale": { + "cooldownPeriod": 350, "maxReplicas": 5, "minReplicas": 1, + "pollingInterval": 35, "rules": [ { "custom": {"metadata": {"concurrentRequests": "50"}, "type": "http"}, @@ -121,6 +133,8 @@ def main(): }, "serviceBinds": [ { + "clientType": "dotnet", + "customizedKeys": {"DesiredKey": "defaultKey"}, "name": "service", "serviceId": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/containerApps/service", } @@ -133,6 +147,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ContainerApps_Patch.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ContainerApps_Patch.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_patches_apply.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_patches_apply.py new file mode 100644 index 000000000000..3ae8181fb130 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_patches_apply.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python container_apps_patches_apply.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.container_apps_patches.begin_apply( + resource_group_name="rg", + container_app_name="test-app", + patch_name="testPatch-25fe4b", + ).result() + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ContainerAppsPatches_Apply.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_patches_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_patches_delete.py new file mode 100644 index 000000000000..46e89807a6d6 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_patches_delete.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python container_apps_patches_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + client.container_apps_patches.begin_delete( + resource_group_name="rg", + container_app_name="test-app", + patch_name="testPatch-25fe4b", + ).result() + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ContainerAppsPatches_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_patches_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_patches_get.py new file mode 100644 index 000000000000..ea96d388a69a --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_patches_get.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python container_apps_patches_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.container_apps_patches.get( + resource_group_name="rg", + container_app_name="test-app", + patch_name="testPatch-25fe4b", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ContainerAppsPatches_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_patches_list_by_container_app.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_patches_list_by_container_app.py new file mode 100644 index 000000000000..137b60c3a890 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_patches_list_by_container_app.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python container_apps_patches_list_by_container_app.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.container_apps_patches.list_by_container_app( + resource_group_name="rg", + container_app_name="test-app", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ContainerAppsPatches_ListByContainerApp.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_patches_skip_configure.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_patches_skip_configure.py new file mode 100644 index 000000000000..8c6cf0adfa0b --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_patches_skip_configure.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python container_apps_patches_skip_configure.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + client.container_apps_patches.begin_skip_configure( + resource_group_name="rg", + container_app_name="test-app", + patch_name="testPatch-25fe4b", + patch_skip_config={"skip": True}, + ).result() + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ContainerAppsPatches_Skip_Configure.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_source_to_cloud_app_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_source_to_cloud_app_create_or_update.py new file mode 100644 index 000000000000..7a0d2a37f956 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_source_to_cloud_app_create_or_update.py @@ -0,0 +1,166 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, + "service": {"type": "redis"}, + }, + "environmentId": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube", + "patchingConfiguration": {"patchingMode": "Automatic"}, + "template": { + "containers": [ + { + "image": "", + "imageType": "CloudBuild", + "name": "testcontainerApp0", + "probes": [ + { + "httpGet": { + "httpHeaders": [{"name": "Custom-Header", "value": "Awesome"}], + "path": "/health", + "port": 8080, + }, + "initialDelaySeconds": 3, + "periodSeconds": 3, + "type": "Liveness", + } + ], + "volumeMounts": [ + {"mountPath": "/mnt/path1", "subPath": "subPath1", "volumeName": "azurefile"}, + {"mountPath": "/mnt/path2", "subPath": "subPath2", "volumeName": "nfsazurefile"}, + ], + } + ], + "initContainers": [ + { + "args": ["-c", "while true; do echo hello; sleep 10;done"], + "command": ["/bin/sh"], + "image": "repo/testcontainerApp0:v4", + "name": "testinitcontainerApp0", + "resources": {"cpu": 0.2, "memory": "100Mi"}, + } + ], + "scale": { + "cooldownPeriod": 350, + "maxReplicas": 5, + "minReplicas": 1, + "pollingInterval": 35, + "rules": [ + { + "custom": {"metadata": {"concurrentRequests": "50"}, "type": "http"}, + "name": "httpscalingrule", + } + ], + }, + "serviceBinds": [ + { + "clientType": "dotnet", + "customizedKeys": {"DesiredKey": "defaultKey"}, + "name": "redisService", + "serviceId": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/containerApps/redisService", + } + ], + "volumes": [ + {"name": "azurefile", "storageName": "storage", "storageType": "AzureFile"}, + {"name": "nfsazurefile", "storageName": "nfsStorage", "storageType": "NfsAzureFile"}, + ], + }, + "workloadProfileName": "My-GP-01", + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ContainerApps_SourceToCloudApp_CreateOrUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_start.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_start.py index 4b0f2b9068d6..b931704058da 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_start.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_start.py @@ -32,11 +32,11 @@ def main(): response = client.container_apps.begin_start( resource_group_name="rg", - container_app_name="testworkerapp0", + container_app_name="testWorkerApp0", ).result() print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ContainerApps_Start.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ContainerApps_Start.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_stop.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_stop.py index 89a46875376b..4e53aecae74d 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_stop.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_stop.py @@ -32,11 +32,11 @@ def main(): response = client.container_apps.begin_stop( resource_group_name="rg", - container_app_name="testworkerApp0", + container_app_name="testWorkerApp0", ).result() print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ContainerApps_Stop.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ContainerApps_Stop.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_tcp_app_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_tcp_app_create_or_update.py index 6a91c457e976..9088967d2cec 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_tcp_app_create_or_update.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_tcp_app_create_or_update.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appcontainers import ContainerAppsAPIClient @@ -34,7 +32,7 @@ def main(): response = client.container_apps.begin_create_or_update( resource_group_name="rg", - container_app_name="testcontainerapptcp", + container_app_name="testcontainerAppTcp", container_app_envelope={ "location": "East US", "properties": { @@ -43,7 +41,7 @@ def main(): "exposedPort": 4000, "external": True, "targetPort": 3000, - "traffic": [{"revisionName": "testcontainerapptcp-ab1234", "weight": 100}], + "traffic": [{"revisionName": "testcontainerAppTcp-ab1234", "weight": 100}], "transport": "tcp", } }, @@ -51,8 +49,8 @@ def main(): "template": { "containers": [ { - "image": "repo/testcontainerapptcp:v1", - "name": "testcontainerapptcp", + "image": "repo/testcontainerAppTcp:v1", + "name": "testcontainerAppTcp", "probes": [ { "initialDelaySeconds": 3, @@ -64,8 +62,10 @@ def main(): } ], "scale": { + "cooldownPeriod": 350, "maxReplicas": 5, "minReplicas": 1, + "pollingInterval": 35, "rules": [{"name": "tcpscalingrule", "tcp": {"metadata": {"concurrentConnections": "50"}}}], }, }, @@ -75,6 +75,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ContainerApps_TcpApp_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ContainerApps_TcpApp_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policies_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policies_delete.py new file mode 100644 index 000000000000..394bfb98e13f --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policies_delete.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python dapr_component_resiliency_policies_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + client.dapr_component_resiliency_policies.delete( + resource_group_name="examplerg", + environment_name="myenvironment", + component_name="mydaprcomponent", + name="myresiliencypolicy", + ) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/DaprComponentResiliencyPolicies_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policies_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policies_get.py new file mode 100644 index 000000000000..7c171732cfb2 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policies_get.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python dapr_component_resiliency_policies_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.dapr_component_resiliency_policies.get( + resource_group_name="examplerg", + environment_name="myenvironment", + component_name="mydaprcomponent", + name="myresiliencypolicy", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/DaprComponentResiliencyPolicies_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policies_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policies_list.py new file mode 100644 index 000000000000..64e1d88ee179 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policies_list.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python dapr_component_resiliency_policies_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.dapr_component_resiliency_policies.list( + resource_group_name="examplerg", + environment_name="myenvironment", + component_name="mydaprcomponent", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/DaprComponentResiliencyPolicies_List.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policy_create_or_update_all_options.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policy_create_or_update_all_options.py new file mode 100644 index 000000000000..c4c74ea43170 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policy_create_or_update_all_options.py @@ -0,0 +1,64 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python dapr_component_resiliency_policy_create_or_update_all_options.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.dapr_component_resiliency_policies.create_or_update( + resource_group_name="examplerg", + environment_name="myenvironment", + component_name="mydaprcomponent", + name="myresiliencypolicy", + dapr_component_resiliency_policy_envelope={ + "properties": { + "inboundPolicy": { + "circuitBreakerPolicy": {"consecutiveErrors": 5, "intervalInSeconds": 4, "timeoutInSeconds": 10}, + "httpRetryPolicy": { + "maxRetries": 15, + "retryBackOff": {"initialDelayInMilliseconds": 2000, "maxIntervalInMilliseconds": 5500}, + }, + "timeoutPolicy": {"responseTimeoutInSeconds": 30}, + }, + "outboundPolicy": { + "circuitBreakerPolicy": {"consecutiveErrors": 3, "intervalInSeconds": 60, "timeoutInSeconds": 20}, + "httpRetryPolicy": { + "maxRetries": 5, + "retryBackOff": {"initialDelayInMilliseconds": 100, "maxIntervalInMilliseconds": 30000}, + }, + "timeoutPolicy": {"responseTimeoutInSeconds": 12}, + }, + } + }, + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/DaprComponentResiliencyPolicy_CreateOrUpdate_AllOptions.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policy_create_or_update_outbound_only.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policy_create_or_update_outbound_only.py new file mode 100644 index 000000000000..7ba3b3bded64 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policy_create_or_update_outbound_only.py @@ -0,0 +1,56 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python dapr_component_resiliency_policy_create_or_update_outbound_only.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.dapr_component_resiliency_policies.create_or_update( + resource_group_name="examplerg", + environment_name="myenvironment", + component_name="mydaprcomponent", + name="myresiliencypolicy", + dapr_component_resiliency_policy_envelope={ + "properties": { + "outboundPolicy": { + "circuitBreakerPolicy": {"consecutiveErrors": 3, "intervalInSeconds": 60, "timeoutInSeconds": 20}, + "httpRetryPolicy": { + "maxRetries": 5, + "retryBackOff": {"initialDelayInMilliseconds": 100, "maxIntervalInMilliseconds": 30000}, + }, + "timeoutPolicy": {"responseTimeoutInSeconds": 12}, + } + } + }, + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/DaprComponentResiliencyPolicy_CreateOrUpdate_OutboundOnly.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policy_create_or_update_sparse_options.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policy_create_or_update_sparse_options.py new file mode 100644 index 000000000000..d6699ea9382e --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policy_create_or_update_sparse_options.py @@ -0,0 +1,56 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python dapr_component_resiliency_policy_create_or_update_sparse_options.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.dapr_component_resiliency_policies.create_or_update( + resource_group_name="examplerg", + environment_name="myenvironment", + component_name="mydaprcomponent", + name="myresiliencypolicy", + dapr_component_resiliency_policy_envelope={ + "properties": { + "inboundPolicy": { + "circuitBreakerPolicy": {"consecutiveErrors": 3, "timeoutInSeconds": 20}, + "httpRetryPolicy": { + "maxRetries": 5, + "retryBackOff": {"initialDelayInMilliseconds": 2000, "maxIntervalInMilliseconds": 5500}, + }, + }, + "outboundPolicy": {"timeoutPolicy": {"responseTimeoutInSeconds": 12}}, + } + }, + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/DaprComponentResiliencyPolicy_CreateOrUpdate_SparseOptions.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_create_or_update_secret_store_component.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_create_or_update_secret_store_component.py index fe6d1a18e37d..9e65fca11fad 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_create_or_update_secret_store_component.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_create_or_update_secret_store_component.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appcontainers import ContainerAppsAPIClient @@ -49,6 +47,13 @@ def main(): ], "scopes": ["container-app-1", "container-app-2"], "secretStoreComponent": "my-secret-store", + "serviceComponentBind": [ + { + "metadata": {"name": "daprcomponentBind", "value": "redis-bind"}, + "name": "statestore", + "serviceId": "/subscriptions/9f7371f1-b593-4c3c-84e2-9167806ad358/resourceGroups/ca-syn2-group/providers/Microsoft.App/containerapps/cappredis", + } + ], "version": "v1", } }, @@ -56,6 +61,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/DaprComponents_CreateOrUpdate_SecretStoreComponent.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/DaprComponents_CreateOrUpdate_SecretStoreComponent.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_create_or_update_secrets.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_create_or_update_secrets.py index 5e087e9e1be1..fd9f72adf0ee 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_create_or_update_secrets.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_create_or_update_secrets.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appcontainers import ContainerAppsAPIClient @@ -49,6 +47,13 @@ def main(): ], "scopes": ["container-app-1", "container-app-2"], "secrets": [{"name": "masterkey", "value": "keyvalue"}], + "serviceComponentBind": [ + { + "metadata": {"name": "daprcomponentBind", "value": "redis-bind"}, + "name": "statestore", + "serviceId": "/subscriptions/9f7371f1-b593-4c3c-84e2-9167806ad358/resourceGroups/ca-syn2-group/providers/Microsoft.App/containerapps/cappredis", + } + ], "version": "v1", } }, @@ -56,6 +61,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/DaprComponents_CreateOrUpdate_Secrets.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/DaprComponents_CreateOrUpdate_Secrets.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_delete.py index b77e9e25a41b..bc2d152efa0b 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_delete.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_delete.py @@ -37,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/DaprComponents_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/DaprComponents_Delete.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_get_secret_store_component.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_get_secret_store_component.py index 704a23da3223..ddb007ce3e77 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_get_secret_store_component.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_get_secret_store_component.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/DaprComponents_Get_SecretStoreComponent.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/DaprComponents_Get_SecretStoreComponent.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_get_secrets.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_get_secrets.py index 6770615c84dc..58575899c8e3 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_get_secrets.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_get_secrets.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/DaprComponents_Get_Secrets.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/DaprComponents_Get_Secrets.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_list.py index 94ea0da382ea..d714ed7bca74 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_list.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_list.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/DaprComponents_List.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/DaprComponents_List.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_list_secrets.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_list_secrets.py index 134ef9102bad..0f1599cd7207 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_list_secrets.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_list_secrets.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/DaprComponents_ListSecrets.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/DaprComponents_ListSecrets.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_create_or_update_bulk_subscribe_and_scopes.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_create_or_update_bulk_subscribe_and_scopes.py new file mode 100644 index 000000000000..a806104af44e --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_create_or_update_bulk_subscribe_and_scopes.py @@ -0,0 +1,52 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python dapr_subscriptions_create_or_update_bulk_subscribe_and_scopes.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.dapr_subscriptions.create_or_update( + resource_group_name="examplerg", + environment_name="myenvironment", + name="mysubscription", + dapr_subscription_envelope={ + "properties": { + "bulkSubscribe": {"enabled": True, "maxAwaitDurationMs": 500, "maxMessagesCount": 123}, + "pubsubName": "mypubsubcomponent", + "routes": {"default": "/products"}, + "scopes": ["warehouseapp", "customersupportapp"], + "topic": "inventory", + } + }, + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/DaprSubscriptions_CreateOrUpdate_BulkSubscribeAndScopes.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_create_or_update_default_route.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_create_or_update_default_route.py new file mode 100644 index 000000000000..861b72b01334 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_create_or_update_default_route.py @@ -0,0 +1,46 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python dapr_subscriptions_create_or_update_default_route.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.dapr_subscriptions.create_or_update( + resource_group_name="examplerg", + environment_name="myenvironment", + name="mysubscription", + dapr_subscription_envelope={ + "properties": {"pubsubName": "mypubsubcomponent", "routes": {"default": "/products"}, "topic": "inventory"} + }, + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/DaprSubscriptions_CreateOrUpdate_DefaultRoute.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_create_or_update_route_rules_and_metadata.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_create_or_update_route_rules_and_metadata.py new file mode 100644 index 000000000000..b9190c4a3420 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_create_or_update_route_rules_and_metadata.py @@ -0,0 +1,57 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python dapr_subscriptions_create_or_update_route_rules_and_metadata.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.dapr_subscriptions.create_or_update( + resource_group_name="examplerg", + environment_name="myenvironment", + name="mysubscription", + dapr_subscription_envelope={ + "properties": { + "metadata": {"foo": "bar", "hello": "world"}, + "pubsubName": "mypubsubcomponent", + "routes": { + "default": "/products", + "rules": [ + {"match": "event.type == 'widget'", "path": "/widgets"}, + {"match": "event.type == 'gadget'", "path": "/gadgets"}, + ], + }, + "topic": "inventory", + } + }, + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/DaprSubscriptions_CreateOrUpdate_RouteRulesAndMetadata.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_delete.py new file mode 100644 index 000000000000..5531aaa71688 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_delete.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python dapr_subscriptions_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + client.dapr_subscriptions.delete( + resource_group_name="examplerg", + environment_name="myenvironment", + name="mysubscription", + ) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/DaprSubscriptions_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_get_bulk_subscribe_and_scopes.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_get_bulk_subscribe_and_scopes.py new file mode 100644 index 000000000000..76c9018263a1 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_get_bulk_subscribe_and_scopes.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python dapr_subscriptions_get_bulk_subscribe_and_scopes.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.dapr_subscriptions.get( + resource_group_name="examplerg", + environment_name="myenvironment", + name="mypubsubcomponent", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/DaprSubscriptions_Get_BulkSubscribeAndScopes.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_get_default_route.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_get_default_route.py new file mode 100644 index 000000000000..eab424bf711a --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_get_default_route.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python dapr_subscriptions_get_default_route.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.dapr_subscriptions.get( + resource_group_name="examplerg", + environment_name="myenvironment", + name="mypubsubcomponent", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/DaprSubscriptions_Get_DefaultRoute.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_get_route_rules_and_metadata.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_get_route_rules_and_metadata.py new file mode 100644 index 000000000000..0bd6e9711f36 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_get_route_rules_and_metadata.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python dapr_subscriptions_get_route_rules_and_metadata.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.dapr_subscriptions.get( + resource_group_name="examplerg", + environment_name="myenvironment", + name="mypubsubcomponent", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/DaprSubscriptions_Get_RouteRulesAndMetadata.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_list.py new file mode 100644 index 000000000000..04baa56e6474 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_list.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python dapr_subscriptions_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.dapr_subscriptions.list( + resource_group_name="examplerg", + environment_name="myenvironment", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/DaprSubscriptions_List.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_create_or_update.py new file mode 100644 index 000000000000..7bf97b63e080 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_create_or_update.py @@ -0,0 +1,49 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python dot_net_components_create_or_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.dot_net_components.begin_create_or_update( + resource_group_name="examplerg", + environment_name="myenvironment", + name="mydotnetcomponent", + dot_net_component_envelope={ + "properties": { + "componentType": "AspireDashboard", + "configurations": [{"propertyName": "dashboard-theme", "value": "dark"}], + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/DotNetComponents_CreateOrUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_create_or_update_service_bind.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_create_or_update_service_bind.py new file mode 100644 index 000000000000..bdf0d33a3abb --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_create_or_update_service_bind.py @@ -0,0 +1,55 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python dot_net_components_create_or_update_service_bind.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.dot_net_components.begin_create_or_update( + resource_group_name="examplerg", + environment_name="myenvironment", + name="mydotnetcomponent", + dot_net_component_envelope={ + "properties": { + "componentType": "AspireDashboard", + "configurations": [{"propertyName": "dashboard-theme", "value": "dark"}], + "serviceBinds": [ + { + "name": "yellowcat", + "serviceId": "/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/myenvironment/dotNetComponents/yellowcat", + } + ], + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/DotNetComponents_CreateOrUpdate_ServiceBind.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_delete.py new file mode 100644 index 000000000000..08d450b57995 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_delete.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python dot_net_components_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + client.dot_net_components.begin_delete( + resource_group_name="examplerg", + environment_name="myenvironment", + name="mydotnetcomponent", + ).result() + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/DotNetComponents_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_get.py new file mode 100644 index 000000000000..af8ccf93d2d3 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_get.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python dot_net_components_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.dot_net_components.get( + resource_group_name="examplerg", + environment_name="myenvironment", + name="mydotnetcomponent", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/DotNetComponents_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_get_service_bind.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_get_service_bind.py new file mode 100644 index 000000000000..95a45b0579e1 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_get_service_bind.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python dot_net_components_get_service_bind.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.dot_net_components.get( + resource_group_name="examplerg", + environment_name="myenvironment", + name="mydotnetcomponent", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/DotNetComponents_Get_ServiceBind.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_list.py new file mode 100644 index 000000000000..e20c21100d1d --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_list.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python dot_net_components_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.dot_net_components.list( + resource_group_name="examplerg", + environment_name="myenvironment", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/DotNetComponents_List.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_list_service_bind.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_list_service_bind.py new file mode 100644 index 000000000000..5509186a4fa4 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_list_service_bind.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python dot_net_components_list_service_bind.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.dot_net_components.list( + resource_group_name="examplerg", + environment_name="myenvironment", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/DotNetComponents_List_ServiceBind.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_patch.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_patch.py new file mode 100644 index 000000000000..b12aa6939207 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_patch.py @@ -0,0 +1,49 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python dot_net_components_patch.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.dot_net_components.begin_update( + resource_group_name="examplerg", + environment_name="myenvironment", + name="mydotnetcomponent", + dot_net_component_envelope={ + "properties": { + "componentType": "AspireDashboard", + "configurations": [{"propertyName": "dashboard-theme", "value": "dark"}], + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/DotNetComponents_Patch.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_patch_service_bind.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_patch_service_bind.py new file mode 100644 index 000000000000..d439a50b57cf --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_patch_service_bind.py @@ -0,0 +1,55 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python dot_net_components_patch_service_bind.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.dot_net_components.begin_update( + resource_group_name="examplerg", + environment_name="myenvironment", + name="mydotnetcomponent", + dot_net_component_envelope={ + "properties": { + "componentType": "AspireDashboard", + "configurations": [{"propertyName": "dashboard-theme", "value": "dark"}], + "serviceBinds": [ + { + "name": "yellowcat", + "serviceId": "/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/myenvironment/dotNetComponents/yellowcat", + } + ], + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/DotNetComponents_Patch_ServiceBind.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/functions_extension_post.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/functions_extension_post.py new file mode 100644 index 000000000000..46a70524d072 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/functions_extension_post.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python functions_extension_post.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + response = client.functions_extension.invoke_functions_host( + resource_group_name="rg", + container_app_name="testcontainerApp0", + revision_name="testcontainerApp0-pjxhsye", + function_app_name="testcontainerApp0", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/FunctionsExtension_Post.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_create_or_update.py new file mode 100644 index 000000000000..78359218bf25 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_create_or_update.py @@ -0,0 +1,53 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python java_components_create_or_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.java_components.begin_create_or_update( + resource_group_name="examplerg", + environment_name="myenvironment", + name="myjavacomponent", + java_component_envelope={ + "properties": { + "componentType": "SpringBootAdmin", + "configurations": [ + {"propertyName": "spring.boot.admin.ui.enable-toasts", "value": "true"}, + {"propertyName": "spring.boot.admin.monitor.status-interval", "value": "10000ms"}, + ], + "scale": {"maxReplicas": 1, "minReplicas": 1}, + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/JavaComponents_CreateOrUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_create_or_update_service_bind.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_create_or_update_service_bind.py new file mode 100644 index 000000000000..0a963ba92c96 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_create_or_update_service_bind.py @@ -0,0 +1,59 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python java_components_create_or_update_service_bind.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.java_components.begin_create_or_update( + resource_group_name="examplerg", + environment_name="myenvironment", + name="myjavacomponent", + java_component_envelope={ + "properties": { + "componentType": "SpringBootAdmin", + "configurations": [ + {"propertyName": "spring.boot.admin.ui.enable-toasts", "value": "true"}, + {"propertyName": "spring.boot.admin.monitor.status-interval", "value": "10000ms"}, + ], + "scale": {"maxReplicas": 1, "minReplicas": 1}, + "serviceBinds": [ + { + "name": "yellowcat", + "serviceId": "/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/myenvironment/javaComponents/yellowcat", + } + ], + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/JavaComponents_CreateOrUpdate_ServiceBind.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_delete.py new file mode 100644 index 000000000000..783cb50c8e1a --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_delete.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python java_components_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + client.java_components.begin_delete( + resource_group_name="examplerg", + environment_name="myenvironment", + name="myjavacomponent", + ).result() + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/JavaComponents_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_get.py new file mode 100644 index 000000000000..f1f2f6ba1733 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_get.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python java_components_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.java_components.get( + resource_group_name="examplerg", + environment_name="myenvironment", + name="myjavacomponent", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/JavaComponents_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_get_service_bind.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_get_service_bind.py new file mode 100644 index 000000000000..9f764f970b73 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_get_service_bind.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python java_components_get_service_bind.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.java_components.get( + resource_group_name="examplerg", + environment_name="myenvironment", + name="myjavacomponent", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/JavaComponents_Get_ServiceBind.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_list.py new file mode 100644 index 000000000000..1dfffd9db9f7 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_list.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python java_components_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.java_components.list( + resource_group_name="examplerg", + environment_name="myenvironment", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/JavaComponents_List.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_list_service_bind.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_list_service_bind.py new file mode 100644 index 000000000000..7e7008efcfbb --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_list_service_bind.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python java_components_list_service_bind.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.java_components.list( + resource_group_name="examplerg", + environment_name="myenvironment", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/JavaComponents_List_ServiceBind.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_patch.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_patch.py new file mode 100644 index 000000000000..7b56ab8543fd --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_patch.py @@ -0,0 +1,53 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python java_components_patch.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.java_components.begin_update( + resource_group_name="examplerg", + environment_name="myenvironment", + name="myjavacomponent", + java_component_envelope={ + "properties": { + "componentType": "SpringBootAdmin", + "configurations": [ + {"propertyName": "spring.boot.admin.ui.enable-toasts", "value": "true"}, + {"propertyName": "spring.boot.admin.monitor.status-interval", "value": "10000ms"}, + ], + "scale": {"maxReplicas": 1, "minReplicas": 1}, + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/JavaComponents_Patch.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_patch_service_bind.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_patch_service_bind.py new file mode 100644 index 000000000000..a8fcc4eba3ed --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_patch_service_bind.py @@ -0,0 +1,59 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python java_components_patch_service_bind.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.java_components.begin_update( + resource_group_name="examplerg", + environment_name="myenvironment", + name="myjavacomponent", + java_component_envelope={ + "properties": { + "componentType": "SpringBootAdmin", + "configurations": [ + {"propertyName": "spring.boot.admin.ui.enable-toasts", "value": "true"}, + {"propertyName": "spring.boot.admin.monitor.status-interval", "value": "10000ms"}, + ], + "scale": {"maxReplicas": 1, "minReplicas": 1}, + "serviceBinds": [ + { + "name": "yellowcat", + "serviceId": "/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/myenvironment/javaComponents/yellowcat", + } + ], + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/JavaComponents_Patch_ServiceBind.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_createor_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_createor_update.py deleted file mode 100644 index f3ddb4bcde78..000000000000 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_createor_update.py +++ /dev/null @@ -1,85 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, IO, Union - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.appcontainers import ContainerAppsAPIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-appcontainers -# USAGE - python job_createor_update.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ContainerAppsAPIClient( - credential=DefaultAzureCredential(), - subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", - ) - - response = client.jobs.begin_create_or_update( - resource_group_name="rg", - job_name="testcontainerappsjob0", - job_envelope={ - "location": "East US", - "properties": { - "configuration": { - "manualTriggerConfig": {"parallelism": 4, "replicaCompletionCount": 1}, - "replicaRetryLimit": 10, - "replicaTimeout": 10, - "triggerType": "Manual", - }, - "environmentId": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube", - "template": { - "containers": [ - { - "image": "repo/testcontainerappsjob0:v1", - "name": "testcontainerappsjob0", - "probes": [ - { - "httpGet": { - "httpHeaders": [{"name": "Custom-Header", "value": "Awesome"}], - "path": "/health", - "port": 8080, - }, - "initialDelaySeconds": 5, - "periodSeconds": 3, - "type": "Liveness", - } - ], - } - ], - "initContainers": [ - { - "args": ["-c", "while true; do echo hello; sleep 10;done"], - "command": ["/bin/sh"], - "image": "repo/testcontainerappsjob0:v4", - "name": "testinitcontainerAppsJob0", - "resources": {"cpu": 0.5, "memory": "1Gi"}, - } - ], - }, - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Job_CreateorUpdate.json -if __name__ == "__main__": - main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_delete.py index 6b06c167dcf1..5aad6377c5c5 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_delete.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_delete.py @@ -32,10 +32,10 @@ def main(): client.jobs.begin_delete( resource_group_name="rg", - job_name="testworkercontainerappsjob0", + job_name="testWorkerContainerAppsJob0", ).result() -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Job_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Job_Delete.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_execution_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_execution_get.py index 2f3c4ab1467c..6f1ec8ca2fe3 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_execution_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_execution_get.py @@ -32,12 +32,12 @@ def main(): response = client.job_execution( resource_group_name="rg", - job_name="testcontainerappsjob0", + job_name="testcontainerAppsJob0", job_execution_name="jobExecution1", ) print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Job_Execution_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Job_Execution_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_executions_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_executions_get.py index ef8f87ed75b2..787f2903c41c 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_executions_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_executions_get.py @@ -32,12 +32,12 @@ def main(): response = client.jobs_executions.list( resource_group_name="rg", - job_name="testcontainerappsjob0", + job_name="testcontainerAppsJob0", ) for item in response: print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Job_Executions_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Job_Executions_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_get.py index 7e30b8cdc1d2..432732fb53e2 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_get.py @@ -32,11 +32,11 @@ def main(): response = client.jobs.get( resource_group_name="rg", - job_name="testcontainerappsjob0", + job_name="testcontainerAppsJob0", ) print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Job_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Job_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_get_detector.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_get_detector.py index babc393e6e1c..c0cd4f3e5e07 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_get_detector.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_get_detector.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Job_GetDetector.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Job_GetDetector.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_list_detectors.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_list_detectors.py index ecd35bee287b..8e3ed688b03d 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_list_detectors.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_list_detectors.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Job_ListDetectors.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Job_ListDetectors.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_list_secrets.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_list_secrets.py index d8e658773abe..45a5d1f3eda2 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_list_secrets.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_list_secrets.py @@ -32,11 +32,11 @@ def main(): response = client.jobs.list_secrets( resource_group_name="rg", - job_name="testcontainerappsjob0", + job_name="testcontainerAppsJob0", ) print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Job_ListSecrets.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Job_ListSecrets.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_proxy_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_proxy_get.py index 2df4d15dc8db..166007f8aa4f 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_proxy_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_proxy_get.py @@ -32,12 +32,12 @@ def main(): response = client.jobs.proxy_get( resource_group_name="rg", - job_name="testcontainerappsjob0", + job_name="testcontainerAppsJob0", api_name="rootApi", ) print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Job_ProxyGet.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Job_ProxyGet.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_start.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_start.py index 883c1318f5c0..660e975ae04e 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_start.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_start.py @@ -32,11 +32,11 @@ def main(): response = client.jobs.begin_start( resource_group_name="rg", - job_name="testcontainerappsjob0", + job_name="testcontainerAppsJob0", ).result() print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Job_Start.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Job_Start.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_stop_execution.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_stop_execution.py index 09a27e753cf6..d9efac99f737 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_stop_execution.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_stop_execution.py @@ -32,11 +32,11 @@ def main(): client.jobs.begin_stop_execution( resource_group_name="rg", - job_name="testcontainerappsjob0", + job_name="testcontainerAppsJob0", job_execution_name="jobExecution1", ).result() -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Job_Stop_Execution.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Job_Stop_Execution.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_stop_multiple.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_stop_multiple.py index e9587c0e5e85..964d950f3103 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_stop_multiple.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_stop_multiple.py @@ -32,11 +32,11 @@ def main(): response = client.jobs.begin_stop_multiple_executions( resource_group_name="rg", - job_name="testcontainerappsjob0", + job_name="testcontainerAppsJob0", ).result() print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Job_Stop_Multiple.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Job_Stop_Multiple.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/jobs_list_by_resource_group.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/jobs_list_by_resource_group.py index 650ce4e217b8..394544855a3b 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/jobs_list_by_resource_group.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/jobs_list_by_resource_group.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Jobs_ListByResourceGroup.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Jobs_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/jobs_list_by_subscription.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/jobs_list_by_subscription.py index 043b2a59bb3a..901b6ca6b3c4 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/jobs_list_by_subscription.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/jobs_list_by_subscription.py @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Jobs_ListBySubscription.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-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..d5103965c699 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/jobs_resume.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python jobs_resume.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + response = client.jobs.begin_resume( + resource_group_name="rg", + job_name="testcontainerAppsJob0", + ).result() + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-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..494dc3570660 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/jobs_suspend.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python jobs_suspend.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + response = client.jobs.begin_suspend( + resource_group_name="rg", + job_name="testcontainerAppsJob0", + ).result() + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Jobs_Suspend.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..b17a83a1db5a --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_create.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python logic_apps_create.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.logic_apps.create_or_update( + resource_group_name="examplerg", + container_app_name="testcontainerApp0", + logic_app_name="testcontainerApp0", + resource={"properties": {}}, + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/LogicApps_Create.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_delete.py new file mode 100644 index 000000000000..3723a6b14dc0 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_delete.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python logic_apps_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + client.logic_apps.delete( + resource_group_name="examplerg", + container_app_name="testcontainerApp0", + logic_app_name="testcontainerApp0", + ) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/LogicApps_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_delete_deploy_workflow_artifacts.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_delete_deploy_workflow_artifacts.py new file mode 100644 index 000000000000..53a088ad48e8 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_delete_deploy_workflow_artifacts.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python logic_apps_delete_deploy_workflow_artifacts.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + client.logic_apps.deploy_workflow_artifacts( + resource_group_name="testrg123", + container_app_name="testapp2", + logic_app_name="testapp2", + ) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/LogicApps_DeleteDeployWorkflowArtifacts.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_get.py new file mode 100644 index 000000000000..3f3bbb065063 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_get.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python logic_apps_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.logic_apps.get( + resource_group_name="examplerg", + container_app_name="testcontainerApp0", + logic_app_name="testcontainerApp0", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/LogicApps_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_get_workflow.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_get_workflow.py new file mode 100644 index 000000000000..10cc104a38d5 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_get_workflow.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python logic_apps_get_workflow.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.logic_apps.get_workflow( + resource_group_name="examplerg", + container_app_name="testcontainerApp0", + logic_app_name="testcontainerApp0", + workflow_name="stateful1", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/LogicApps_GetWorkflow.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_list_connections.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_list_connections.py new file mode 100644 index 000000000000..0df82c749ed7 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_list_connections.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python logic_apps_list_connections.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + response = client.logic_apps.list_workflows_connections( + resource_group_name="testrg123", + container_app_name="testapp2", + logic_app_name="testapp2", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/LogicApps_ListConnections.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_list_workflows.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_list_workflows.py new file mode 100644 index 000000000000..1760beb7571c --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_list_workflows.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python logic_apps_list_workflows.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.logic_apps.list_workflows( + resource_group_name="examplerg", + container_app_name="testcontainerApp0", + logic_app_name="testcontainerApp0", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/LogicApps_ListWorkflows.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_post_deploy_workflow_artifacts.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_post_deploy_workflow_artifacts.py new file mode 100644 index 000000000000..f2d1b47a8a05 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/logic_apps_post_deploy_workflow_artifacts.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python logic_apps_post_deploy_workflow_artifacts.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + client.logic_apps.deploy_workflow_artifacts( + resource_group_name="testrg123", + container_app_name="testapp2", + logic_app_name="testapp2", + ) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/LogicApps_PostDeployWorkflowArtifacts.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificate_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificate_create_or_update.py index ddfc5f4f71b9..0a78917c2a1b 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificate_create_or_update.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificate_create_or_update.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ManagedCertificate_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ManagedCertificate_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificate_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificate_delete.py index 7cd14a089046..88d24e1ba8fb 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificate_delete.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificate_delete.py @@ -37,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ManagedCertificate_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ManagedCertificate_Delete.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificate_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificate_get.py index a7ccc42102b2..af53b64175c2 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificate_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificate_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ManagedCertificate_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ManagedCertificate_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificates_list_by_managed_environment.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificates_list_by_managed_environment.py index 4941f24b8a2f..a75a51c33023 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificates_list_by_managed_environment.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificates_list_by_managed_environment.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ManagedCertificates_ListByManagedEnvironment.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ManagedCertificates_ListByManagedEnvironment.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificates_patch.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificates_patch.py index a1ee2af5d93a..b05a6fd36ff3 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificates_patch.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificates_patch.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appcontainers import ContainerAppsAPIClient @@ -41,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ManagedCertificates_Patch.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ManagedCertificates_Patch.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_diagnostics_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_diagnostics_get.py index 9c5737f1cd68..f0059c7b40bb 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_diagnostics_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_diagnostics_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ManagedEnvironmentDiagnostics_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ManagedEnvironmentDiagnostics_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_diagnostics_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_diagnostics_list.py index 60b3bed0ac13..05db0567889d 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_diagnostics_list.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_diagnostics_list.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ManagedEnvironmentDiagnostics_List.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ManagedEnvironmentDiagnostics_List.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_private_endpoint_connections_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_private_endpoint_connections_create_or_update.py new file mode 100644 index 000000000000..ac50de426bf2 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_private_endpoint_connections_create_or_update.py @@ -0,0 +1,46 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python managed_environment_private_endpoint_connections_create_or_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.managed_environment_private_endpoint_connections.begin_create_or_update( + resource_group_name="examplerg", + environment_name="managedEnv", + private_endpoint_connection_name="jlaw-demo1", + private_endpoint_connection_envelope={ + "properties": {"privateLinkServiceConnectionState": {"actionsRequired": "None", "status": "Approved"}} + }, + ).result() + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ManagedEnvironmentPrivateEndpointConnections_CreateOrUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_private_endpoint_connections_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_private_endpoint_connections_delete.py new file mode 100644 index 000000000000..4cda07073ec4 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_private_endpoint_connections_delete.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python managed_environment_private_endpoint_connections_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + client.managed_environment_private_endpoint_connections.begin_delete( + resource_group_name="examplerg", + environment_name="managedEnv", + private_endpoint_connection_name="jlaw-demo1", + ).result() + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ManagedEnvironmentPrivateEndpointConnections_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_private_endpoint_connections_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_private_endpoint_connections_get.py new file mode 100644 index 000000000000..f294ecfe6ebc --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_private_endpoint_connections_get.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python managed_environment_private_endpoint_connections_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.managed_environment_private_endpoint_connections.get( + resource_group_name="examplerg", + environment_name="managedEnv", + private_endpoint_connection_name="jlaw-demo1", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ManagedEnvironmentPrivateEndpointConnections_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_private_endpoint_connections_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_private_endpoint_connections_list.py new file mode 100644 index 000000000000..f324695db3db --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_private_endpoint_connections_list.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python managed_environment_private_endpoint_connections_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.managed_environment_private_endpoint_connections.list( + resource_group_name="examplerg", + environment_name="managedEnv", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ManagedEnvironmentPrivateEndpointConnections_List.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_private_link_resources_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_private_link_resources_list.py new file mode 100644 index 000000000000..771e0aa19b54 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_private_link_resources_list.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python managed_environment_private_link_resources_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.managed_environment_private_link_resources.list( + resource_group_name="examplerg", + environment_name="managedEnv", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ManagedEnvironmentPrivateLinkResources_List.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_usages_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_usages_list.py index 16677f20f1e6..aa809adeb2e3 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_usages_list.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_usages_list.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ManagedEnvironmentUsages_List.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ManagedEnvironmentUsages_List.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_create_or_update.py index 1ceb49120e57..5fa930b36332 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_create_or_update.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_create_or_update.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appcontainers import ContainerAppsAPIClient @@ -36,15 +34,46 @@ def main(): resource_group_name="examplerg", environment_name="testcontainerenv", environment_envelope={ + "identity": { + "type": "SystemAssigned, UserAssigned", + "userAssignedIdentities": { + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contoso-resources/providers/Microsoft.ManagedIdentity/userAssignedIdentities/contoso-identity": {} + }, + }, "location": "East US", "properties": { - "appLogsConfiguration": {"logAnalyticsConfiguration": {"customerId": "string", "sharedKey": "string"}}, + "appInsightsConfiguration": { + "connectionString": "InstrumentationKey=00000000-0000-0000-0000-000000000000;IngestionEndpoint=https://eastus-8.in.applicationinsights.azure.com/;LiveEndpoint=https://eastus.livediagnostics.monitor.azure.com/" + }, + "appLogsConfiguration": { + "logAnalyticsConfiguration": { + "customerId": "string", + "dynamicJsonColumns": True, + "sharedKey": "string", + } + }, "customDomainConfiguration": { "certificatePassword": "1234", "certificateValue": "Y2VydA==", "dnsSuffix": "www.my-name.com", }, "daprAIConnectionString": "InstrumentationKey=00000000-0000-0000-0000-000000000000;IngestionEndpoint=https://northcentralus-0.in.applicationinsights.azure.com/", + "openTelemetryConfiguration": { + "destinationsConfiguration": { + "dataDogConfiguration": {"key": "000000000000000000000000", "site": "string"}, + "otlpConfigurations": [ + { + "endpoint": "dashboard.k8s.region.azurecontainerapps.io:80", + "headers": [{"key": "api-key", "value": "xxxxxxxxxxx"}], + "insecure": True, + "name": "dashboard", + } + ], + }, + "logsConfiguration": {"destinations": ["appInsights"]}, + "metricsConfiguration": {"destinations": ["dataDog"], "includeKeda": True}, + "tracesConfiguration": {"destinations": ["appInsights"], "includeDapr": True}, + }, "peerAuthentication": {"mtls": {"enabled": True}}, "peerTrafficConfiguration": {"encryption": {"enabled": True}}, "vnetConfiguration": { @@ -52,6 +81,7 @@ def main(): }, "workloadProfiles": [ { + "enableFips": True, "maximumCount": 12, "minimumCount": 3, "name": "My-GP-01", @@ -78,6 +108,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ManagedEnvironments_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ManagedEnvironments_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_custom_infrastructure_resource_group_create.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_custom_infrastructure_resource_group_create.py index 75aab76e8862..8f8767d800dc 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_custom_infrastructure_resource_group_create.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_custom_infrastructure_resource_group_create.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appcontainers import ContainerAppsAPIClient @@ -51,6 +49,7 @@ def main(): }, "workloadProfiles": [ { + "enableFips": True, "maximumCount": 12, "minimumCount": 3, "name": "My-GP-01", @@ -77,6 +76,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ManagedEnvironments_CustomInfrastructureResourceGroup_Create.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ManagedEnvironments_CustomInfrastructureResourceGroup_Create.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_delete.py index 69b97651992a..835a60c6ba03 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_delete.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_delete.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ManagedEnvironments_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ManagedEnvironments_Delete.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_get.py index 21ecd8d3baff..c8161473a4a0 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_get.py @@ -33,7 +33,7 @@ def main(): ) print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ManagedEnvironments_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ManagedEnvironments_Get.json if __name__ == "__main__": main() n__": diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_get_auth_token.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_get_auth_token.py index 3a452548c78a..d62bf60ab031 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_get_auth_token.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_get_auth_token.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ManagedEnvironments_GetAuthToken.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ManagedEnvironments_GetAuthToken.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_list_by_resource_group.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_list_by_resource_group.py index 529bada3b593..f6b0a88941b7 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_list_by_resource_group.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_list_by_resource_group.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ManagedEnvironments_ListByResourceGroup.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ManagedEnvironments_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_list_by_subscription.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_list_by_subscription.py index 934110969aaf..fa26dbe7803e 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_list_by_subscription.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_list_by_subscription.py @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ManagedEnvironments_ListBySubscription.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ManagedEnvironments_ListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_list_workload_profile_states.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_list_workload_profile_states.py index fad3cedf2a2d..61c26bbbff07 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_list_workload_profile_states.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_list_workload_profile_states.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ManagedEnvironments_ListWorkloadProfileStates.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ManagedEnvironments_ListWorkloadProfileStates.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_patch.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_patch.py index 7a89e7285d6f..a42e432b9031 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_patch.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_patch.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appcontainers import ContainerAppsAPIClient @@ -40,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ManagedEnvironments_Patch.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ManagedEnvironments_Patch.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_create_or_update.py index 85711c657610..a3d5b15e6e3a 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_create_or_update.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_create_or_update.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appcontainers import ContainerAppsAPIClient @@ -50,6 +48,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ManagedEnvironmentsStorages_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ManagedEnvironmentsStorages_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_create_or_update_nfs_azure_file.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_create_or_update_nfs_azure_file.py new file mode 100644 index 000000000000..87655ae18c0e --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_create_or_update_nfs_azure_file.py @@ -0,0 +1,46 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python managed_environments_storages_create_or_update_nfs_azure_file.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.managed_environments_storages.create_or_update( + resource_group_name="examplerg", + environment_name="managedEnv", + storage_name="jlaw-demo1", + storage_envelope={ + "properties": {"nfsAzureFile": {"accessMode": "ReadOnly", "server": "server1", "shareName": "share1"}} + }, + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ManagedEnvironmentsStorages_CreateOrUpdate_NfsAzureFile.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_delete.py index a942a596aaf2..e8d45d34bc46 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_delete.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_delete.py @@ -37,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ManagedEnvironmentsStorages_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ManagedEnvironmentsStorages_Delete.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_get.py index 6d47c9f474d1..1506b49d9b30 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ManagedEnvironmentsStorages_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ManagedEnvironmentsStorages_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_get_nfs_azure_file.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_get_nfs_azure_file.py new file mode 100644 index 000000000000..a69c23be4467 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_get_nfs_azure_file.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python managed_environments_storages_get_nfs_azure_file.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.managed_environments_storages.get( + resource_group_name="examplerg", + environment_name="managedEnv", + storage_name="jlaw-demo1", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ManagedEnvironmentsStorages_Get_NfsAzureFile.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_list.py index 3fa7a7d4b11a..e27605853999 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_list.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_list.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/ManagedEnvironmentsStorages_List.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/ManagedEnvironmentsStorages_List.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/operations_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/operations_list.py index 8b3049de3638..d945168ac5c0 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/operations_list.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/operations_list.py @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Operations_List.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Operations_List.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/replicas_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/replicas_get.py index f90a1ec8bc8a..4d55341354b1 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/replicas_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/replicas_get.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Replicas_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Replicas_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/replicas_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/replicas_list.py index d6bda773f347..1620ba85d3de 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/replicas_list.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/replicas_list.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Replicas_List.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Replicas_List.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_activate.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_activate.py index 7b0ed29bf13e..c1fc63f741ea 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_activate.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_activate.py @@ -37,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Revisions_Activate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Revisions_Activate.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_deactivate.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_deactivate.py index e26fdd3716c8..50cdbdd917af 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_deactivate.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_deactivate.py @@ -37,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Revisions_Deactivate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Revisions_Deactivate.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_get.py index 732d0564a0d3..0cb1046f492b 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Revisions_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Revisions_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_list.py index 68f48f1db6de..fc17ef5677bc 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_list.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_list.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Revisions_List.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Revisions_List.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_restart.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_restart.py index faafa805c696..018d3b7f8917 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_restart.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_restart.py @@ -37,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Revisions_Restart.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Revisions_Restart.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_createor_update_event_trigger.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/session_pools_create_or_update.py similarity index 54% rename from sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_createor_update_event_trigger.py rename to sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/session_pools_create_or_update.py index 5e948fcbfd82..a9466d929675 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_createor_update_event_trigger.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/session_pools_create_or_update.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appcontainers import ContainerAppsAPIClient @@ -17,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-appcontainers # USAGE - python job_createor_update_event_trigger.py + python session_pools_create_or_update.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -32,52 +30,36 @@ def main(): subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) - response = client.jobs.begin_create_or_update( + response = client.container_apps_session_pools.begin_create_or_update( resource_group_name="rg", - job_name="testcontainerappsjob0", - job_envelope={ + session_pool_name="testsessionpool", + session_pool_envelope={ "location": "East US", "properties": { - "configuration": { - "eventTriggerConfig": { - "parallelism": 4, - "replicaCompletionCount": 1, - "scale": { - "maxExecutions": 5, - "minExecutions": 1, - "pollingInterval": 40, - "rules": [ - { - "metadata": {"topicName": "my-topic"}, - "name": "servicebuscalingrule", - "type": "azure-servicebus", - } - ], - }, - }, - "replicaRetryLimit": 10, - "replicaTimeout": 10, - "triggerType": "Event", - }, - "environmentId": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube", - "template": { - "containers": [{"image": "repo/testcontainerappsjob0:v1", "name": "testcontainerappsjob0"}], - "initContainers": [ + "containerType": "CustomContainer", + "customContainerTemplate": { + "containers": [ { "args": ["-c", "while true; do echo hello; sleep 10;done"], "command": ["/bin/sh"], - "image": "repo/testcontainerappsjob0:v4", - "name": "testinitcontainerAppsJob0", - "resources": {"cpu": 0.5, "memory": "1Gi"}, + "image": "repo/testcontainer:v4", + "name": "testinitcontainer", + "resources": {"cpu": 0.25, "memory": "0.5Gi"}, } ], + "ingress": {"targetPort": 80}, }, + "dynamicPoolConfiguration": {"cooldownPeriodInSeconds": 600, "executionType": "Timed"}, + "environmentId": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube", + "poolManagementType": "Dynamic", + "scaleConfiguration": {"maxConcurrentSessions": 500, "readySessionInstances": 100}, + "sessionNetworkConfiguration": {"status": "EgressEnabled"}, }, }, ).result() print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Job_CreateorUpdate_EventTrigger.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/SessionPools_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/session_pools_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/session_pools_delete.py new file mode 100644 index 000000000000..87437162a7c2 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/session_pools_delete.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python session_pools_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + client.container_apps_session_pools.begin_delete( + resource_group_name="rg", + session_pool_name="testsessionpool", + ).result() + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/SessionPools_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/session_pools_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/session_pools_get.py new file mode 100644 index 000000000000..2c8cced5037b --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/session_pools_get.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python session_pools_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + response = client.container_apps_session_pools.get( + resource_group_name="rg", + session_pool_name="testsessionpool", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/SessionPools_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/session_pools_list_by_resource_group.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/session_pools_list_by_resource_group.py new file mode 100644 index 000000000000..ecc34901eb6e --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/session_pools_list_by_resource_group.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python session_pools_list_by_resource_group.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + response = client.container_apps_session_pools.list_by_resource_group( + resource_group_name="rg", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/SessionPools_ListByResourceGroup.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/session_pools_list_by_subscription.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/session_pools_list_by_subscription.py new file mode 100644 index 000000000000..5a621a6ca5bb --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/session_pools_list_by_subscription.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python session_pools_list_by_subscription.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + response = client.container_apps_session_pools.list_by_subscription() + for item in response: + print(item) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/SessionPools_ListBySubscription.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_patch.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/session_pools_patch.py similarity index 51% rename from sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_patch.py rename to sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/session_pools_patch.py index a923c994dd36..ec4fb6a3bff4 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_patch.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/session_pools_patch.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appcontainers import ContainerAppsAPIClient @@ -17,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-appcontainers # USAGE - python job_patch.py + python session_pools_patch.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -32,52 +30,32 @@ def main(): subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", ) - response = client.jobs.begin_update( + response = client.container_apps_session_pools.begin_update( resource_group_name="rg", - job_name="testcontainerappsjob0", - job_envelope={ + session_pool_name="testsessionpool", + session_pool_envelope={ "properties": { - "configuration": { - "manualTriggerConfig": {"parallelism": 4, "replicaCompletionCount": 1}, - "replicaRetryLimit": 10, - "replicaTimeout": 10, - "triggerType": "Manual", - }, - "template": { + "customContainerTemplate": { "containers": [ - { - "image": "repo/testcontainerappsjob0:v1", - "name": "testcontainerappsjob0", - "probes": [ - { - "httpGet": { - "httpHeaders": [{"name": "Custom-Header", "value": "Awesome"}], - "path": "/health", - "port": 8080, - }, - "initialDelaySeconds": 3, - "periodSeconds": 3, - "type": "Liveness", - } - ], - } - ], - "initContainers": [ { "args": ["-c", "while true; do echo hello; sleep 10;done"], "command": ["/bin/sh"], - "image": "repo/testcontainerappsjob0:v4", - "name": "testinitcontainerAppsJob0", - "resources": {"cpu": 0.5, "memory": "1Gi"}, + "image": "repo/testcontainer:v4", + "name": "testinitcontainer", + "resources": {"cpu": 0.25, "memory": "0.5Gi"}, } ], + "ingress": {"targetPort": 80}, }, + "dynamicPoolConfiguration": {"cooldownPeriodInSeconds": 600, "executionType": "Timed"}, + "scaleConfiguration": {"maxConcurrentSessions": 500, "readySessionInstances": 100}, + "sessionNetworkConfiguration": {"status": "EgressEnabled"}, } }, ).result() print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Job_Patch.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/SessionPools_Patch.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/source_controls_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/source_controls_create_or_update.py index ce791ab93ee0..546e8c7f7c50 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/source_controls_create_or_update.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/source_controls_create_or_update.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.appcontainers import ContainerAppsAPIClient @@ -46,7 +44,9 @@ def main(): "kind": "feaderated", "tenantId": "", }, + "buildEnvironmentVariables": [{"name": "foo1", "value": "bar1"}, {"name": "foo2", "value": "bar2"}], "contextPath": "./", + "dockerfilePath": "./Dockerfile", "githubPersonalAccessToken": "test", "image": "image/tag", "registryInfo": { @@ -62,6 +62,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/SourceControls_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/SourceControls_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/source_controls_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/source_controls_delete.py index 6d0b6b962576..190c5f835db5 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/source_controls_delete.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/source_controls_delete.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/SourceControls_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/SourceControls_Delete.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/source_controls_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/source_controls_get.py index 2b0cc9cb70cd..fe678c5d8efb 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/source_controls_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/source_controls_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/SourceControls_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/SourceControls_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/source_controls_list_by_container.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/source_controls_list_by_container.py index 1351c607e646..858543e28e02 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/source_controls_list_by_container.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/source_controls_list_by_container.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/SourceControls_ListByContainer.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/SourceControls_ListByContainer.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/subscriptions_get_custom_domain_verification_id.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/subscriptions_get_custom_domain_verification_id.py index 10e891b6f3b8..16e4146f2b8a 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/subscriptions_get_custom_domain_verification_id.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/subscriptions_get_custom_domain_verification_id.py @@ -34,6 +34,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Subscriptions_GetCustomDomainVerificationId.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Subscriptions_GetCustomDomainVerificationId.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/usages_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/usages_list.py index e40fedb4050e..62f7320f33b0 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/usages_list.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/usages_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2024-03-01/examples/Usages_List.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2024-08-02-preview/examples/Usages_List.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api.py index d82f71473a23..94215044ea12 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api.py @@ -25,7 +25,7 @@ def test_job_execution(self, resource_group): resource_group_name=resource_group.name, job_name="str", job_execution_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself @@ -35,7 +35,7 @@ def test_job_execution(self, resource_group): @recorded_by_proxy def test_get_custom_domain_verification_id(self, resource_group): response = self.client.get_custom_domain_verification_id( - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_app_resiliency_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_app_resiliency_operations.py new file mode 100644 index 000000000000..54644f94f304 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_app_resiliency_operations.py @@ -0,0 +1,151 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIAppResiliencyOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update(self, resource_group): + response = self.client.app_resiliency.create_or_update( + resource_group_name=resource_group.name, + app_name="str", + name="str", + resiliency_envelope={ + "circuitBreakerPolicy": {"consecutiveErrors": 0, "intervalInSeconds": 0, "maxEjectionPercent": 0}, + "httpConnectionPool": {"http1MaxPendingRequests": 0, "http2MaxRequests": 0}, + "httpRetryPolicy": { + "errors": ["str"], + "headers": [ + { + "exactMatch": "str", + "header": "str", + "prefixMatch": "str", + "regexMatch": "str", + "suffixMatch": "str", + } + ], + "httpStatusCodes": [0], + "initialDelayInMilliseconds": 0, + "maxIntervalInMilliseconds": 0, + "maxRetries": 0, + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tcpConnectionPool": {"maxConnections": 0}, + "tcpRetryPolicy": {"maxConnectAttempts": 0}, + "timeoutPolicy": {"connectionTimeoutInSeconds": 0, "responseTimeoutInSeconds": 0}, + "type": "str", + }, + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update(self, resource_group): + response = self.client.app_resiliency.update( + resource_group_name=resource_group.name, + app_name="str", + name="str", + resiliency_envelope={ + "circuitBreakerPolicy": {"consecutiveErrors": 0, "intervalInSeconds": 0, "maxEjectionPercent": 0}, + "httpConnectionPool": {"http1MaxPendingRequests": 0, "http2MaxRequests": 0}, + "httpRetryPolicy": { + "errors": ["str"], + "headers": [ + { + "exactMatch": "str", + "header": "str", + "prefixMatch": "str", + "regexMatch": "str", + "suffixMatch": "str", + } + ], + "httpStatusCodes": [0], + "initialDelayInMilliseconds": 0, + "maxIntervalInMilliseconds": 0, + "maxRetries": 0, + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tcpConnectionPool": {"maxConnections": 0}, + "tcpRetryPolicy": {"maxConnectAttempts": 0}, + "timeoutPolicy": {"connectionTimeoutInSeconds": 0, "responseTimeoutInSeconds": 0}, + "type": "str", + }, + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete(self, resource_group): + response = self.client.app_resiliency.delete( + resource_group_name=resource_group.name, + app_name="str", + name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.app_resiliency.get( + resource_group_name=resource_group.name, + app_name="str", + name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.app_resiliency.list( + resource_group_name=resource_group.name, + app_name="str", + api_version="2024-08-02-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_app_resiliency_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_app_resiliency_operations_async.py new file mode 100644 index 000000000000..ff4be53d4302 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_app_resiliency_operations_async.py @@ -0,0 +1,152 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIAppResiliencyOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update(self, resource_group): + response = await self.client.app_resiliency.create_or_update( + resource_group_name=resource_group.name, + app_name="str", + name="str", + resiliency_envelope={ + "circuitBreakerPolicy": {"consecutiveErrors": 0, "intervalInSeconds": 0, "maxEjectionPercent": 0}, + "httpConnectionPool": {"http1MaxPendingRequests": 0, "http2MaxRequests": 0}, + "httpRetryPolicy": { + "errors": ["str"], + "headers": [ + { + "exactMatch": "str", + "header": "str", + "prefixMatch": "str", + "regexMatch": "str", + "suffixMatch": "str", + } + ], + "httpStatusCodes": [0], + "initialDelayInMilliseconds": 0, + "maxIntervalInMilliseconds": 0, + "maxRetries": 0, + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tcpConnectionPool": {"maxConnections": 0}, + "tcpRetryPolicy": {"maxConnectAttempts": 0}, + "timeoutPolicy": {"connectionTimeoutInSeconds": 0, "responseTimeoutInSeconds": 0}, + "type": "str", + }, + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update(self, resource_group): + response = await self.client.app_resiliency.update( + resource_group_name=resource_group.name, + app_name="str", + name="str", + resiliency_envelope={ + "circuitBreakerPolicy": {"consecutiveErrors": 0, "intervalInSeconds": 0, "maxEjectionPercent": 0}, + "httpConnectionPool": {"http1MaxPendingRequests": 0, "http2MaxRequests": 0}, + "httpRetryPolicy": { + "errors": ["str"], + "headers": [ + { + "exactMatch": "str", + "header": "str", + "prefixMatch": "str", + "regexMatch": "str", + "suffixMatch": "str", + } + ], + "httpStatusCodes": [0], + "initialDelayInMilliseconds": 0, + "maxIntervalInMilliseconds": 0, + "maxRetries": 0, + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tcpConnectionPool": {"maxConnections": 0}, + "tcpRetryPolicy": {"maxConnectAttempts": 0}, + "timeoutPolicy": {"connectionTimeoutInSeconds": 0, "responseTimeoutInSeconds": 0}, + "type": "str", + }, + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete(self, resource_group): + response = await self.client.app_resiliency.delete( + resource_group_name=resource_group.name, + app_name="str", + name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.app_resiliency.get( + resource_group_name=resource_group.name, + app_name="str", + name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.app_resiliency.list( + resource_group_name=resource_group.name, + app_name="str", + api_version="2024-08-02-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_async.py index 716eb1d91235..ef584fad5d2d 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_async.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_async.py @@ -26,7 +26,7 @@ async def test_job_execution(self, resource_group): resource_group_name=resource_group.name, job_name="str", job_execution_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself @@ -36,7 +36,7 @@ async def test_job_execution(self, resource_group): @recorded_by_proxy_async async def test_get_custom_domain_verification_id(self, resource_group): response = await self.client.get_custom_domain_verification_id( - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_available_workload_profiles_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_available_workload_profiles_operations.py index 6948c249259b..8eae410d0d89 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_available_workload_profiles_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_available_workload_profiles_operations.py @@ -23,7 +23,7 @@ def setup_method(self, method): def test_get(self, resource_group): response = self.client.available_workload_profiles.get( location="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_available_workload_profiles_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_available_workload_profiles_operations_async.py index e6ab51877e5e..f1c9e48ffecb 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_available_workload_profiles_operations_async.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_available_workload_profiles_operations_async.py @@ -24,7 +24,7 @@ def setup_method(self, method): async def test_get(self, resource_group): response = self.client.available_workload_profiles.get( location="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_billing_meters_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_billing_meters_operations.py index 37180bee78a0..275a3238118c 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_billing_meters_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_billing_meters_operations.py @@ -23,7 +23,7 @@ def setup_method(self, method): def test_get(self, resource_group): response = self.client.billing_meters.get( location="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_billing_meters_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_billing_meters_operations_async.py index 82c9273ce85e..f0b99ca05854 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_billing_meters_operations_async.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_billing_meters_operations_async.py @@ -24,7 +24,7 @@ def setup_method(self, method): async def test_get(self, resource_group): response = await self.client.billing_meters.get( location="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_build_auth_token_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_build_auth_token_operations.py new file mode 100644 index 000000000000..d042638f1658 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_build_auth_token_operations.py @@ -0,0 +1,32 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIBuildAuthTokenOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.build_auth_token.list( + resource_group_name=resource_group.name, + builder_name="str", + build_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_build_auth_token_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_build_auth_token_operations_async.py new file mode 100644 index 000000000000..c318505cab15 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_build_auth_token_operations_async.py @@ -0,0 +1,33 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIBuildAuthTokenOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = await self.client.build_auth_token.list( + resource_group_name=resource_group.name, + builder_name="str", + build_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_builders_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_builders_operations.py new file mode 100644 index 000000000000..bf0aa1457acc --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_builders_operations.py @@ -0,0 +1,122 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIBuildersOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_subscription(self, resource_group): + response = self.client.builders.list_by_subscription( + api_version="2024-08-02-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_resource_group(self, resource_group): + response = self.client.builders.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2024-08-02-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.builders.get( + resource_group_name=resource_group.name, + builder_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.builders.begin_create_or_update( + resource_group_name=resource_group.name, + builder_name="str", + builder_envelope={ + "location": "str", + "containerRegistries": [{"containerRegistryServer": "str", "identityResourceId": "str"}], + "environmentId": "str", + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "name": "str", + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2024-08-02-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_update(self, resource_group): + response = self.client.builders.begin_update( + resource_group_name=resource_group.name, + builder_name="str", + builder_envelope={ + "environmentId": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "tags": {"str": "str"}, + }, + api_version="2024-08-02-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.builders.begin_delete( + resource_group_name=resource_group.name, + builder_name="str", + api_version="2024-08-02-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_builders_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_builders_operations_async.py new file mode 100644 index 000000000000..22c6c7970201 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_builders_operations_async.py @@ -0,0 +1,129 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIBuildersOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_subscription(self, resource_group): + response = self.client.builders.list_by_subscription( + api_version="2024-08-02-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_resource_group(self, resource_group): + response = self.client.builders.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2024-08-02-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.builders.get( + resource_group_name=resource_group.name, + builder_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.builders.begin_create_or_update( + resource_group_name=resource_group.name, + builder_name="str", + builder_envelope={ + "location": "str", + "containerRegistries": [{"containerRegistryServer": "str", "identityResourceId": "str"}], + "environmentId": "str", + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "name": "str", + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2024-08-02-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_update(self, resource_group): + response = await ( + await self.client.builders.begin_update( + resource_group_name=resource_group.name, + builder_name="str", + builder_envelope={ + "environmentId": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "tags": {"str": "str"}, + }, + api_version="2024-08-02-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.builders.begin_delete( + resource_group_name=resource_group.name, + builder_name="str", + api_version="2024-08-02-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_builds_by_builder_resource_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_builds_by_builder_resource_operations.py new file mode 100644 index 000000000000..b09222cbb50d --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_builds_by_builder_resource_operations.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIBuildsByBuilderResourceOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.builds_by_builder_resource.list( + resource_group_name=resource_group.name, + builder_name="str", + api_version="2024-08-02-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_builds_by_builder_resource_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_builds_by_builder_resource_operations_async.py new file mode 100644 index 000000000000..3bb9dc3a779f --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_builds_by_builder_resource_operations_async.py @@ -0,0 +1,32 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIBuildsByBuilderResourceOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.builds_by_builder_resource.list( + resource_group_name=resource_group.name, + builder_name="str", + api_version="2024-08-02-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_builds_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_builds_operations.py new file mode 100644 index 000000000000..27fc8b6e19e6 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_builds_operations.py @@ -0,0 +1,90 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIBuildsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.builds.get( + resource_group_name=resource_group.name, + builder_name="str", + build_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.builds.begin_create_or_update( + resource_group_name=resource_group.name, + builder_name="str", + build_name="str", + build_envelope={ + "buildStatus": "str", + "configuration": { + "baseOs": "str", + "environmentVariables": [{"name": "str", "value": "str"}], + "platform": "str", + "platformVersion": "str", + "preBuildSteps": [ + { + "description": "str", + "httpGet": {"url": "str", "fileName": "str", "headers": ["str"]}, + "scripts": ["str"], + } + ], + }, + "destinationContainerRegistry": {"server": "str", "image": "str"}, + "id": "str", + "logStreamEndpoint": "str", + "name": "str", + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tokenEndpoint": "str", + "type": "str", + "uploadEndpoint": "str", + }, + api_version="2024-08-02-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.builds.begin_delete( + resource_group_name=resource_group.name, + builder_name="str", + build_name="str", + api_version="2024-08-02-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_builds_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_builds_operations_async.py new file mode 100644 index 000000000000..8926a7c50342 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_builds_operations_async.py @@ -0,0 +1,95 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIBuildsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.builds.get( + resource_group_name=resource_group.name, + builder_name="str", + build_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.builds.begin_create_or_update( + resource_group_name=resource_group.name, + builder_name="str", + build_name="str", + build_envelope={ + "buildStatus": "str", + "configuration": { + "baseOs": "str", + "environmentVariables": [{"name": "str", "value": "str"}], + "platform": "str", + "platformVersion": "str", + "preBuildSteps": [ + { + "description": "str", + "httpGet": {"url": "str", "fileName": "str", "headers": ["str"]}, + "scripts": ["str"], + } + ], + }, + "destinationContainerRegistry": {"server": "str", "image": "str"}, + "id": "str", + "logStreamEndpoint": "str", + "name": "str", + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tokenEndpoint": "str", + "type": "str", + "uploadEndpoint": "str", + }, + api_version="2024-08-02-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.builds.begin_delete( + resource_group_name=resource_group.name, + builder_name="str", + build_name="str", + api_version="2024-08-02-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_certificates_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_certificates_operations.py index 4121a6412c41..bb71a5ae354f 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_certificates_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_certificates_operations.py @@ -24,7 +24,7 @@ def test_list(self, resource_group): response = self.client.certificates.list( resource_group_name=resource_group.name, environment_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -37,7 +37,7 @@ def test_get(self, resource_group): resource_group_name=resource_group.name, environment_name="str", certificate_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself @@ -50,7 +50,7 @@ def test_create_or_update(self, resource_group): resource_group_name=resource_group.name, environment_name="str", certificate_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself @@ -63,7 +63,7 @@ def test_delete(self, resource_group): resource_group_name=resource_group.name, environment_name="str", certificate_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself @@ -77,7 +77,7 @@ def test_update(self, resource_group): environment_name="str", certificate_name="str", certificate_envelope={"tags": {"str": "str"}}, - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_certificates_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_certificates_operations_async.py index 6d55ddc67e4b..fa7528f15ff7 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_certificates_operations_async.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_certificates_operations_async.py @@ -25,7 +25,7 @@ async def test_list(self, resource_group): response = self.client.certificates.list( resource_group_name=resource_group.name, environment_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -38,7 +38,7 @@ async def test_get(self, resource_group): resource_group_name=resource_group.name, environment_name="str", certificate_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself @@ -51,7 +51,7 @@ async def test_create_or_update(self, resource_group): resource_group_name=resource_group.name, environment_name="str", certificate_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself @@ -64,7 +64,7 @@ async def test_delete(self, resource_group): resource_group_name=resource_group.name, environment_name="str", certificate_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself @@ -78,7 +78,7 @@ async def test_update(self, resource_group): environment_name="str", certificate_name="str", certificate_envelope={"tags": {"str": "str"}}, - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_certificates_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_certificates_operations.py index ae2bdb1f1c8f..90e7557395ce 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_certificates_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_certificates_operations.py @@ -24,7 +24,7 @@ def test_list(self, resource_group): response = self.client.connected_environments_certificates.list( resource_group_name=resource_group.name, connected_environment_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -37,7 +37,7 @@ def test_get(self, resource_group): resource_group_name=resource_group.name, connected_environment_name="str", certificate_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself @@ -50,7 +50,7 @@ def test_create_or_update(self, resource_group): resource_group_name=resource_group.name, connected_environment_name="str", certificate_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself @@ -63,7 +63,7 @@ def test_delete(self, resource_group): resource_group_name=resource_group.name, connected_environment_name="str", certificate_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself @@ -77,7 +77,7 @@ def test_update(self, resource_group): connected_environment_name="str", certificate_name="str", certificate_envelope={"tags": {"str": "str"}}, - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_certificates_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_certificates_operations_async.py index fdb2391bf174..1aecd0cca672 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_certificates_operations_async.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_certificates_operations_async.py @@ -25,7 +25,7 @@ async def test_list(self, resource_group): response = self.client.connected_environments_certificates.list( resource_group_name=resource_group.name, connected_environment_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -38,7 +38,7 @@ async def test_get(self, resource_group): resource_group_name=resource_group.name, connected_environment_name="str", certificate_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself @@ -51,7 +51,7 @@ async def test_create_or_update(self, resource_group): resource_group_name=resource_group.name, connected_environment_name="str", certificate_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself @@ -64,7 +64,7 @@ async def test_delete(self, resource_group): resource_group_name=resource_group.name, connected_environment_name="str", certificate_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself @@ -78,7 +78,7 @@ async def test_update(self, resource_group): connected_environment_name="str", certificate_name="str", certificate_envelope={"tags": {"str": "str"}}, - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_dapr_components_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_dapr_components_operations.py index fb3d650fb0ac..d8e59805808a 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_dapr_components_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_dapr_components_operations.py @@ -24,7 +24,7 @@ def test_list(self, resource_group): response = self.client.connected_environments_dapr_components.list( resource_group_name=resource_group.name, connected_environment_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -37,7 +37,7 @@ def test_get(self, resource_group): resource_group_name=resource_group.name, connected_environment_name="str", component_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself @@ -60,6 +60,9 @@ def test_create_or_update(self, resource_group): "scopes": ["str"], "secretStoreComponent": "str", "secrets": [{"identity": "str", "keyVaultUrl": "str", "name": "str", "value": "str"}], + "serviceComponentBind": [ + {"metadata": {"name": "str", "value": "str"}, "name": "str", "serviceId": "str"} + ], "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -71,7 +74,7 @@ def test_create_or_update(self, resource_group): "type": "str", "version": "str", }, - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself @@ -84,7 +87,7 @@ def test_delete(self, resource_group): resource_group_name=resource_group.name, connected_environment_name="str", component_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself @@ -97,7 +100,7 @@ def test_list_secrets(self, resource_group): resource_group_name=resource_group.name, connected_environment_name="str", component_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_dapr_components_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_dapr_components_operations_async.py index 988b44a31192..1c70aa13e458 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_dapr_components_operations_async.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_dapr_components_operations_async.py @@ -25,7 +25,7 @@ async def test_list(self, resource_group): response = self.client.connected_environments_dapr_components.list( resource_group_name=resource_group.name, connected_environment_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -38,7 +38,7 @@ async def test_get(self, resource_group): resource_group_name=resource_group.name, connected_environment_name="str", component_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself @@ -61,6 +61,9 @@ async def test_create_or_update(self, resource_group): "scopes": ["str"], "secretStoreComponent": "str", "secrets": [{"identity": "str", "keyVaultUrl": "str", "name": "str", "value": "str"}], + "serviceComponentBind": [ + {"metadata": {"name": "str", "value": "str"}, "name": "str", "serviceId": "str"} + ], "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -72,7 +75,7 @@ async def test_create_or_update(self, resource_group): "type": "str", "version": "str", }, - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself @@ -85,7 +88,7 @@ async def test_delete(self, resource_group): resource_group_name=resource_group.name, connected_environment_name="str", component_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself @@ -98,7 +101,7 @@ async def test_list_secrets(self, resource_group): resource_group_name=resource_group.name, connected_environment_name="str", component_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_operations.py index ae8eb9f64b0e..d8d65eaeb645 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_operations.py @@ -22,7 +22,7 @@ def setup_method(self, method): @recorded_by_proxy def test_list_by_subscription(self, resource_group): response = self.client.connected_environments.list_by_subscription( - api_version="2024-03-01", + api_version="2024-08-02-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -33,7 +33,7 @@ def test_list_by_subscription(self, resource_group): def test_list_by_resource_group(self, resource_group): response = self.client.connected_environments.list_by_resource_group( resource_group_name=resource_group.name, - api_version="2024-03-01", + api_version="2024-08-02-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -45,7 +45,7 @@ def test_get(self, resource_group): response = self.client.connected_environments.get( resource_group_name=resource_group.name, connected_environment_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself @@ -60,6 +60,7 @@ def test_begin_create_or_update(self, resource_group): environment_envelope={ "location": "str", "customDomainConfiguration": { + "certificateKeyVaultProperties": {"identity": "str", "keyVaultUrl": "str"}, "certificatePassword": "str", "certificateValue": bytes("bytes", encoding="utf-8"), "customDomainVerificationId": "str", @@ -87,7 +88,7 @@ def test_begin_create_or_update(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2024-03-01", + api_version="2024-08-02-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -99,7 +100,7 @@ def test_begin_delete(self, resource_group): response = self.client.connected_environments.begin_delete( resource_group_name=resource_group.name, connected_environment_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -111,7 +112,7 @@ def test_update(self, resource_group): response = self.client.connected_environments.update( resource_group_name=resource_group.name, connected_environment_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself @@ -124,7 +125,7 @@ def test_check_name_availability(self, resource_group): resource_group_name=resource_group.name, connected_environment_name="str", check_name_availability_request={"name": "str", "type": "str"}, - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_operations_async.py index 17f6e480b79d..20b583aecca8 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_operations_async.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_operations_async.py @@ -23,7 +23,7 @@ def setup_method(self, method): @recorded_by_proxy_async async def test_list_by_subscription(self, resource_group): response = self.client.connected_environments.list_by_subscription( - api_version="2024-03-01", + api_version="2024-08-02-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -34,7 +34,7 @@ async def test_list_by_subscription(self, resource_group): async def test_list_by_resource_group(self, resource_group): response = self.client.connected_environments.list_by_resource_group( resource_group_name=resource_group.name, - api_version="2024-03-01", + api_version="2024-08-02-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -46,7 +46,7 @@ async def test_get(self, resource_group): response = await self.client.connected_environments.get( resource_group_name=resource_group.name, connected_environment_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself @@ -62,6 +62,7 @@ async def test_begin_create_or_update(self, resource_group): environment_envelope={ "location": "str", "customDomainConfiguration": { + "certificateKeyVaultProperties": {"identity": "str", "keyVaultUrl": "str"}, "certificatePassword": "str", "certificateValue": bytes("bytes", encoding="utf-8"), "customDomainVerificationId": "str", @@ -89,7 +90,7 @@ async def test_begin_create_or_update(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2024-03-01", + api_version="2024-08-02-preview", ) ).result() # call '.result()' to poll until service return final result @@ -103,7 +104,7 @@ async def test_begin_delete(self, resource_group): await self.client.connected_environments.begin_delete( resource_group_name=resource_group.name, connected_environment_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) ).result() # call '.result()' to poll until service return final result @@ -116,7 +117,7 @@ async def test_update(self, resource_group): response = await self.client.connected_environments.update( resource_group_name=resource_group.name, connected_environment_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself @@ -129,7 +130,7 @@ async def test_check_name_availability(self, resource_group): resource_group_name=resource_group.name, connected_environment_name="str", check_name_availability_request={"name": "str", "type": "str"}, - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_storages_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_storages_operations.py index 49e6968e87c3..9d23204d77e3 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_storages_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_storages_operations.py @@ -24,7 +24,7 @@ def test_list(self, resource_group): response = self.client.connected_environments_storages.list( resource_group_name=resource_group.name, connected_environment_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself @@ -37,7 +37,7 @@ def test_get(self, resource_group): resource_group_name=resource_group.name, connected_environment_name="str", storage_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself @@ -54,7 +54,15 @@ def test_create_or_update(self, resource_group): "id": "str", "name": "str", "properties": { - "azureFile": {"accessMode": "str", "accountKey": "str", "accountName": "str", "shareName": "str"} + "azureFile": {"accessMode": "str", "accountKey": "str", "accountName": "str", "shareName": "str"}, + "smb": { + "accessMode": "str", + "domain": "str", + "host": "str", + "password": "str", + "shareName": "str", + "username": "str", + }, }, "systemData": { "createdAt": "2020-02-20 00:00:00", @@ -66,7 +74,7 @@ def test_create_or_update(self, resource_group): }, "type": "str", }, - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself @@ -79,7 +87,7 @@ def test_delete(self, resource_group): resource_group_name=resource_group.name, connected_environment_name="str", storage_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_storages_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_storages_operations_async.py index e0735233e1c3..2f61ad4ecc5a 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_storages_operations_async.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_connected_environments_storages_operations_async.py @@ -25,7 +25,7 @@ async def test_list(self, resource_group): response = await self.client.connected_environments_storages.list( resource_group_name=resource_group.name, connected_environment_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself @@ -38,7 +38,7 @@ async def test_get(self, resource_group): resource_group_name=resource_group.name, connected_environment_name="str", storage_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself @@ -55,7 +55,15 @@ async def test_create_or_update(self, resource_group): "id": "str", "name": "str", "properties": { - "azureFile": {"accessMode": "str", "accountKey": "str", "accountName": "str", "shareName": "str"} + "azureFile": {"accessMode": "str", "accountKey": "str", "accountName": "str", "shareName": "str"}, + "smb": { + "accessMode": "str", + "domain": "str", + "host": "str", + "password": "str", + "shareName": "str", + "username": "str", + }, }, "systemData": { "createdAt": "2020-02-20 00:00:00", @@ -67,7 +75,7 @@ async def test_create_or_update(self, resource_group): }, "type": "str", }, - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself @@ -80,7 +88,7 @@ async def test_delete(self, resource_group): resource_group_name=resource_group.name, connected_environment_name="str", storage_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_auth_configs_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_auth_configs_operations.py index 72c31728e087..a05430f40e0d 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_auth_configs_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_auth_configs_operations.py @@ -24,7 +24,7 @@ def test_list_by_container_app(self, resource_group): response = self.client.container_apps_auth_configs.list_by_container_app( resource_group_name=resource_group.name, container_app_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -37,7 +37,7 @@ def test_get(self, resource_group): resource_group_name=resource_group.name, container_app_name="str", auth_config_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself @@ -161,7 +161,7 @@ def test_create_or_update(self, resource_group): }, "type": "str", }, - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself @@ -174,7 +174,7 @@ def test_delete(self, resource_group): resource_group_name=resource_group.name, container_app_name="str", auth_config_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_auth_configs_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_auth_configs_operations_async.py index 86a7203c755f..a5de3d34523f 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_auth_configs_operations_async.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_auth_configs_operations_async.py @@ -25,7 +25,7 @@ async def test_list_by_container_app(self, resource_group): response = self.client.container_apps_auth_configs.list_by_container_app( resource_group_name=resource_group.name, container_app_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -38,7 +38,7 @@ async def test_get(self, resource_group): resource_group_name=resource_group.name, container_app_name="str", auth_config_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself @@ -162,7 +162,7 @@ async def test_create_or_update(self, resource_group): }, "type": "str", }, - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself @@ -175,7 +175,7 @@ async def test_delete(self, resource_group): resource_group_name=resource_group.name, container_app_name="str", auth_config_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_builds_by_container_app_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_builds_by_container_app_operations.py new file mode 100644 index 000000000000..de15466e9fb8 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_builds_by_container_app_operations.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIContainerAppsBuildsByContainerAppOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.container_apps_builds_by_container_app.list( + resource_group_name=resource_group.name, + container_app_name="str", + api_version="2024-08-02-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_builds_by_container_app_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_builds_by_container_app_operations_async.py new file mode 100644 index 000000000000..88f9aa60204e --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_builds_by_container_app_operations_async.py @@ -0,0 +1,32 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIContainerAppsBuildsByContainerAppOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.container_apps_builds_by_container_app.list( + resource_group_name=resource_group.name, + container_app_name="str", + api_version="2024-08-02-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_builds_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_builds_operations.py new file mode 100644 index 000000000000..b401d0208703 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_builds_operations.py @@ -0,0 +1,45 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIContainerAppsBuildsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.container_apps_builds.get( + resource_group_name=resource_group.name, + container_app_name="str", + build_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.container_apps_builds.begin_delete( + resource_group_name=resource_group.name, + container_app_name="str", + build_name="str", + api_version="2024-08-02-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_builds_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_builds_operations_async.py new file mode 100644 index 000000000000..d3686d69e48e --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_builds_operations_async.py @@ -0,0 +1,48 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIContainerAppsBuildsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.container_apps_builds.get( + resource_group_name=resource_group.name, + container_app_name="str", + build_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.container_apps_builds.begin_delete( + resource_group_name=resource_group.name, + container_app_name="str", + build_name="str", + api_version="2024-08-02-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_diagnostics_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_diagnostics_operations.py index 6a8d78112bc9..6feb281ecca7 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_diagnostics_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_diagnostics_operations.py @@ -24,7 +24,7 @@ def test_list_detectors(self, resource_group): response = self.client.container_apps_diagnostics.list_detectors( resource_group_name=resource_group.name, container_app_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -37,7 +37,7 @@ def test_get_detector(self, resource_group): resource_group_name=resource_group.name, container_app_name="str", detector_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself @@ -49,7 +49,7 @@ def test_list_revisions(self, resource_group): response = self.client.container_apps_diagnostics.list_revisions( resource_group_name=resource_group.name, container_app_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -62,7 +62,7 @@ def test_get_revision(self, resource_group): resource_group_name=resource_group.name, container_app_name="str", revision_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself @@ -74,7 +74,7 @@ def test_get_root(self, resource_group): response = self.client.container_apps_diagnostics.get_root( resource_group_name=resource_group.name, container_app_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_diagnostics_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_diagnostics_operations_async.py index 4531aa56ad90..31469c25d996 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_diagnostics_operations_async.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_diagnostics_operations_async.py @@ -25,7 +25,7 @@ async def test_list_detectors(self, resource_group): response = self.client.container_apps_diagnostics.list_detectors( resource_group_name=resource_group.name, container_app_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -38,7 +38,7 @@ async def test_get_detector(self, resource_group): resource_group_name=resource_group.name, container_app_name="str", detector_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself @@ -50,7 +50,7 @@ async def test_list_revisions(self, resource_group): response = self.client.container_apps_diagnostics.list_revisions( resource_group_name=resource_group.name, container_app_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -63,7 +63,7 @@ async def test_get_revision(self, resource_group): resource_group_name=resource_group.name, container_app_name="str", revision_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself @@ -75,7 +75,7 @@ async def test_get_root(self, resource_group): response = await self.client.container_apps_diagnostics.get_root( resource_group_name=resource_group.name, container_app_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_operations.py index 6c517f7440be..990c849a6efc 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_operations.py @@ -22,7 +22,7 @@ def setup_method(self, method): @recorded_by_proxy def test_list_by_subscription(self, resource_group): response = self.client.container_apps.list_by_subscription( - api_version="2024-03-01", + api_version="2024-08-02-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -33,7 +33,7 @@ def test_list_by_subscription(self, resource_group): def test_list_by_resource_group(self, resource_group): response = self.client.container_apps.list_by_resource_group( resource_group_name=resource_group.name, - api_version="2024-03-01", + api_version="2024-08-02-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -45,7 +45,7 @@ def test_get(self, resource_group): response = self.client.container_apps.get( resource_group_name=resource_group.name, container_app_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself @@ -71,6 +71,7 @@ def test_begin_create_or_update(self, resource_group): "httpReadBufferSize": 0, "logLevel": "str", }, + "identitySettings": [{"identity": "str", "lifecycle": "All"}], "ingress": { "additionalPortMappings": [{"external": bool, "targetPort": 0, "exposedPort": 0}], "allowInsecure": False, @@ -92,15 +93,27 @@ def test_begin_create_or_update(self, resource_group): ], "stickySessions": {"affinity": "str"}, "targetPort": 0, + "targetPortHttpScheme": "str", "traffic": [{"label": "str", "latestRevision": False, "revisionName": "str", "weight": 0}], "transport": "auto", }, "maxInactiveRevisions": 0, "registries": [{"identity": "str", "passwordSecretRef": "str", "server": "str", "username": "str"}], + "runtime": { + "dotnet": {"autoConfigureDataProtection": bool}, + "java": { + "enableMetrics": bool, + "javaAgent": { + "enabled": bool, + "logging": {"loggerSettings": [{"level": "str", "logger": "str"}]}, + }, + }, + }, "secrets": [{"identity": "str", "keyVaultUrl": "str", "name": "str", "value": "str"}], "service": {"type": "str"}, }, "customDomainVerificationId": "str", + "deploymentErrors": "str", "environmentId": "str", "eventStreamEndpoint": "str", "extendedLocation": {"name": "str", "type": "str"}, @@ -111,6 +124,7 @@ def test_begin_create_or_update(self, resource_group): "tenantId": "str", "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, }, + "kind": "str", "latestReadyRevisionName": "str", "latestRevisionFqdn": "str", "latestRevisionName": "str", @@ -118,6 +132,7 @@ def test_begin_create_or_update(self, resource_group): "managedEnvironmentId": "str", "name": "str", "outboundIpAddresses": ["str"], + "patchingConfiguration": {"patchingMode": "str"}, "provisioningState": "str", "systemData": { "createdAt": "2020-02-20 00:00:00", @@ -135,6 +150,7 @@ def test_begin_create_or_update(self, resource_group): "command": ["str"], "env": [{"name": "str", "secretRef": "str", "value": "str"}], "image": "str", + "imageType": "str", "name": "str", "probes": [ { @@ -165,6 +181,7 @@ def test_begin_create_or_update(self, resource_group): "command": ["str"], "env": [{"name": "str", "secretRef": "str", "value": "str"}], "image": "str", + "imageType": "str", "name": "str", "resources": {"cpu": 0.0, "ephemeralStorage": "str", "memory": "str"}, "volumeMounts": [{"mountPath": "str", "subPath": "str", "volumeName": "str"}], @@ -172,33 +189,42 @@ def test_begin_create_or_update(self, resource_group): ], "revisionSuffix": "str", "scale": { + "cooldownPeriod": 0, "maxReplicas": 10, "minReplicas": 0, + "pollingInterval": 0, "rules": [ { "azureQueue": { + "accountName": "str", "auth": [{"secretRef": "str", "triggerParameter": "str"}], + "identity": "str", "queueLength": 0, "queueName": "str", }, "custom": { "auth": [{"secretRef": "str", "triggerParameter": "str"}], + "identity": "str", "metadata": {"str": "str"}, "type": "str", }, "http": { "auth": [{"secretRef": "str", "triggerParameter": "str"}], + "identity": "str", "metadata": {"str": "str"}, }, "name": "str", "tcp": { "auth": [{"secretRef": "str", "triggerParameter": "str"}], + "identity": "str", "metadata": {"str": "str"}, }, } ], }, - "serviceBinds": [{"name": "str", "serviceId": "str"}], + "serviceBinds": [ + {"clientType": "str", "customizedKeys": {"str": "str"}, "name": "str", "serviceId": "str"} + ], "terminationGracePeriodSeconds": 0, "volumes": [ { @@ -213,7 +239,7 @@ def test_begin_create_or_update(self, resource_group): "type": "str", "workloadProfileName": "str", }, - api_version="2024-03-01", + api_version="2024-08-02-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -225,7 +251,7 @@ def test_begin_delete(self, resource_group): response = self.client.container_apps.begin_delete( resource_group_name=resource_group.name, container_app_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -251,6 +277,7 @@ def test_begin_update(self, resource_group): "httpReadBufferSize": 0, "logLevel": "str", }, + "identitySettings": [{"identity": "str", "lifecycle": "All"}], "ingress": { "additionalPortMappings": [{"external": bool, "targetPort": 0, "exposedPort": 0}], "allowInsecure": False, @@ -272,15 +299,27 @@ def test_begin_update(self, resource_group): ], "stickySessions": {"affinity": "str"}, "targetPort": 0, + "targetPortHttpScheme": "str", "traffic": [{"label": "str", "latestRevision": False, "revisionName": "str", "weight": 0}], "transport": "auto", }, "maxInactiveRevisions": 0, "registries": [{"identity": "str", "passwordSecretRef": "str", "server": "str", "username": "str"}], + "runtime": { + "dotnet": {"autoConfigureDataProtection": bool}, + "java": { + "enableMetrics": bool, + "javaAgent": { + "enabled": bool, + "logging": {"loggerSettings": [{"level": "str", "logger": "str"}]}, + }, + }, + }, "secrets": [{"identity": "str", "keyVaultUrl": "str", "name": "str", "value": "str"}], "service": {"type": "str"}, }, "customDomainVerificationId": "str", + "deploymentErrors": "str", "environmentId": "str", "eventStreamEndpoint": "str", "extendedLocation": {"name": "str", "type": "str"}, @@ -291,6 +330,7 @@ def test_begin_update(self, resource_group): "tenantId": "str", "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, }, + "kind": "str", "latestReadyRevisionName": "str", "latestRevisionFqdn": "str", "latestRevisionName": "str", @@ -298,6 +338,7 @@ def test_begin_update(self, resource_group): "managedEnvironmentId": "str", "name": "str", "outboundIpAddresses": ["str"], + "patchingConfiguration": {"patchingMode": "str"}, "provisioningState": "str", "systemData": { "createdAt": "2020-02-20 00:00:00", @@ -315,6 +356,7 @@ def test_begin_update(self, resource_group): "command": ["str"], "env": [{"name": "str", "secretRef": "str", "value": "str"}], "image": "str", + "imageType": "str", "name": "str", "probes": [ { @@ -345,6 +387,7 @@ def test_begin_update(self, resource_group): "command": ["str"], "env": [{"name": "str", "secretRef": "str", "value": "str"}], "image": "str", + "imageType": "str", "name": "str", "resources": {"cpu": 0.0, "ephemeralStorage": "str", "memory": "str"}, "volumeMounts": [{"mountPath": "str", "subPath": "str", "volumeName": "str"}], @@ -352,33 +395,42 @@ def test_begin_update(self, resource_group): ], "revisionSuffix": "str", "scale": { + "cooldownPeriod": 0, "maxReplicas": 10, "minReplicas": 0, + "pollingInterval": 0, "rules": [ { "azureQueue": { + "accountName": "str", "auth": [{"secretRef": "str", "triggerParameter": "str"}], + "identity": "str", "queueLength": 0, "queueName": "str", }, "custom": { "auth": [{"secretRef": "str", "triggerParameter": "str"}], + "identity": "str", "metadata": {"str": "str"}, "type": "str", }, "http": { "auth": [{"secretRef": "str", "triggerParameter": "str"}], + "identity": "str", "metadata": {"str": "str"}, }, "name": "str", "tcp": { "auth": [{"secretRef": "str", "triggerParameter": "str"}], + "identity": "str", "metadata": {"str": "str"}, }, } ], }, - "serviceBinds": [{"name": "str", "serviceId": "str"}], + "serviceBinds": [ + {"clientType": "str", "customizedKeys": {"str": "str"}, "name": "str", "serviceId": "str"} + ], "terminationGracePeriodSeconds": 0, "volumes": [ { @@ -393,7 +445,7 @@ def test_begin_update(self, resource_group): "type": "str", "workloadProfileName": "str", }, - api_version="2024-03-01", + api_version="2024-08-02-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -405,7 +457,7 @@ def test_list_custom_host_name_analysis(self, resource_group): response = self.client.container_apps.list_custom_host_name_analysis( resource_group_name=resource_group.name, container_app_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself @@ -417,7 +469,7 @@ def test_list_secrets(self, resource_group): response = self.client.container_apps.list_secrets( resource_group_name=resource_group.name, container_app_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself @@ -429,7 +481,7 @@ def test_get_auth_token(self, resource_group): response = self.client.container_apps.get_auth_token( resource_group_name=resource_group.name, container_app_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself @@ -441,7 +493,7 @@ def test_begin_start(self, resource_group): response = self.client.container_apps.begin_start( resource_group_name=resource_group.name, container_app_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -453,7 +505,7 @@ def test_begin_stop(self, resource_group): response = self.client.container_apps.begin_stop( resource_group_name=resource_group.name, container_app_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_operations_async.py index 1a16c76a581c..79bf6b517286 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_operations_async.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_operations_async.py @@ -23,7 +23,7 @@ def setup_method(self, method): @recorded_by_proxy_async async def test_list_by_subscription(self, resource_group): response = self.client.container_apps.list_by_subscription( - api_version="2024-03-01", + api_version="2024-08-02-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -34,7 +34,7 @@ async def test_list_by_subscription(self, resource_group): async def test_list_by_resource_group(self, resource_group): response = self.client.container_apps.list_by_resource_group( resource_group_name=resource_group.name, - api_version="2024-03-01", + api_version="2024-08-02-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -46,7 +46,7 @@ async def test_get(self, resource_group): response = await self.client.container_apps.get( resource_group_name=resource_group.name, container_app_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself @@ -73,6 +73,7 @@ async def test_begin_create_or_update(self, resource_group): "httpReadBufferSize": 0, "logLevel": "str", }, + "identitySettings": [{"identity": "str", "lifecycle": "All"}], "ingress": { "additionalPortMappings": [{"external": bool, "targetPort": 0, "exposedPort": 0}], "allowInsecure": False, @@ -94,6 +95,7 @@ async def test_begin_create_or_update(self, resource_group): ], "stickySessions": {"affinity": "str"}, "targetPort": 0, + "targetPortHttpScheme": "str", "traffic": [{"label": "str", "latestRevision": False, "revisionName": "str", "weight": 0}], "transport": "auto", }, @@ -101,10 +103,21 @@ async def test_begin_create_or_update(self, resource_group): "registries": [ {"identity": "str", "passwordSecretRef": "str", "server": "str", "username": "str"} ], + "runtime": { + "dotnet": {"autoConfigureDataProtection": bool}, + "java": { + "enableMetrics": bool, + "javaAgent": { + "enabled": bool, + "logging": {"loggerSettings": [{"level": "str", "logger": "str"}]}, + }, + }, + }, "secrets": [{"identity": "str", "keyVaultUrl": "str", "name": "str", "value": "str"}], "service": {"type": "str"}, }, "customDomainVerificationId": "str", + "deploymentErrors": "str", "environmentId": "str", "eventStreamEndpoint": "str", "extendedLocation": {"name": "str", "type": "str"}, @@ -115,6 +128,7 @@ async def test_begin_create_or_update(self, resource_group): "tenantId": "str", "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, }, + "kind": "str", "latestReadyRevisionName": "str", "latestRevisionFqdn": "str", "latestRevisionName": "str", @@ -122,6 +136,7 @@ async def test_begin_create_or_update(self, resource_group): "managedEnvironmentId": "str", "name": "str", "outboundIpAddresses": ["str"], + "patchingConfiguration": {"patchingMode": "str"}, "provisioningState": "str", "systemData": { "createdAt": "2020-02-20 00:00:00", @@ -139,6 +154,7 @@ async def test_begin_create_or_update(self, resource_group): "command": ["str"], "env": [{"name": "str", "secretRef": "str", "value": "str"}], "image": "str", + "imageType": "str", "name": "str", "probes": [ { @@ -169,6 +185,7 @@ async def test_begin_create_or_update(self, resource_group): "command": ["str"], "env": [{"name": "str", "secretRef": "str", "value": "str"}], "image": "str", + "imageType": "str", "name": "str", "resources": {"cpu": 0.0, "ephemeralStorage": "str", "memory": "str"}, "volumeMounts": [{"mountPath": "str", "subPath": "str", "volumeName": "str"}], @@ -176,33 +193,42 @@ async def test_begin_create_or_update(self, resource_group): ], "revisionSuffix": "str", "scale": { + "cooldownPeriod": 0, "maxReplicas": 10, "minReplicas": 0, + "pollingInterval": 0, "rules": [ { "azureQueue": { + "accountName": "str", "auth": [{"secretRef": "str", "triggerParameter": "str"}], + "identity": "str", "queueLength": 0, "queueName": "str", }, "custom": { "auth": [{"secretRef": "str", "triggerParameter": "str"}], + "identity": "str", "metadata": {"str": "str"}, "type": "str", }, "http": { "auth": [{"secretRef": "str", "triggerParameter": "str"}], + "identity": "str", "metadata": {"str": "str"}, }, "name": "str", "tcp": { "auth": [{"secretRef": "str", "triggerParameter": "str"}], + "identity": "str", "metadata": {"str": "str"}, }, } ], }, - "serviceBinds": [{"name": "str", "serviceId": "str"}], + "serviceBinds": [ + {"clientType": "str", "customizedKeys": {"str": "str"}, "name": "str", "serviceId": "str"} + ], "terminationGracePeriodSeconds": 0, "volumes": [ { @@ -217,7 +243,7 @@ async def test_begin_create_or_update(self, resource_group): "type": "str", "workloadProfileName": "str", }, - api_version="2024-03-01", + api_version="2024-08-02-preview", ) ).result() # call '.result()' to poll until service return final result @@ -231,7 +257,7 @@ async def test_begin_delete(self, resource_group): await self.client.container_apps.begin_delete( resource_group_name=resource_group.name, container_app_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) ).result() # call '.result()' to poll until service return final result @@ -259,6 +285,7 @@ async def test_begin_update(self, resource_group): "httpReadBufferSize": 0, "logLevel": "str", }, + "identitySettings": [{"identity": "str", "lifecycle": "All"}], "ingress": { "additionalPortMappings": [{"external": bool, "targetPort": 0, "exposedPort": 0}], "allowInsecure": False, @@ -280,6 +307,7 @@ async def test_begin_update(self, resource_group): ], "stickySessions": {"affinity": "str"}, "targetPort": 0, + "targetPortHttpScheme": "str", "traffic": [{"label": "str", "latestRevision": False, "revisionName": "str", "weight": 0}], "transport": "auto", }, @@ -287,10 +315,21 @@ async def test_begin_update(self, resource_group): "registries": [ {"identity": "str", "passwordSecretRef": "str", "server": "str", "username": "str"} ], + "runtime": { + "dotnet": {"autoConfigureDataProtection": bool}, + "java": { + "enableMetrics": bool, + "javaAgent": { + "enabled": bool, + "logging": {"loggerSettings": [{"level": "str", "logger": "str"}]}, + }, + }, + }, "secrets": [{"identity": "str", "keyVaultUrl": "str", "name": "str", "value": "str"}], "service": {"type": "str"}, }, "customDomainVerificationId": "str", + "deploymentErrors": "str", "environmentId": "str", "eventStreamEndpoint": "str", "extendedLocation": {"name": "str", "type": "str"}, @@ -301,6 +340,7 @@ async def test_begin_update(self, resource_group): "tenantId": "str", "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, }, + "kind": "str", "latestReadyRevisionName": "str", "latestRevisionFqdn": "str", "latestRevisionName": "str", @@ -308,6 +348,7 @@ async def test_begin_update(self, resource_group): "managedEnvironmentId": "str", "name": "str", "outboundIpAddresses": ["str"], + "patchingConfiguration": {"patchingMode": "str"}, "provisioningState": "str", "systemData": { "createdAt": "2020-02-20 00:00:00", @@ -325,6 +366,7 @@ async def test_begin_update(self, resource_group): "command": ["str"], "env": [{"name": "str", "secretRef": "str", "value": "str"}], "image": "str", + "imageType": "str", "name": "str", "probes": [ { @@ -355,6 +397,7 @@ async def test_begin_update(self, resource_group): "command": ["str"], "env": [{"name": "str", "secretRef": "str", "value": "str"}], "image": "str", + "imageType": "str", "name": "str", "resources": {"cpu": 0.0, "ephemeralStorage": "str", "memory": "str"}, "volumeMounts": [{"mountPath": "str", "subPath": "str", "volumeName": "str"}], @@ -362,33 +405,42 @@ async def test_begin_update(self, resource_group): ], "revisionSuffix": "str", "scale": { + "cooldownPeriod": 0, "maxReplicas": 10, "minReplicas": 0, + "pollingInterval": 0, "rules": [ { "azureQueue": { + "accountName": "str", "auth": [{"secretRef": "str", "triggerParameter": "str"}], + "identity": "str", "queueLength": 0, "queueName": "str", }, "custom": { "auth": [{"secretRef": "str", "triggerParameter": "str"}], + "identity": "str", "metadata": {"str": "str"}, "type": "str", }, "http": { "auth": [{"secretRef": "str", "triggerParameter": "str"}], + "identity": "str", "metadata": {"str": "str"}, }, "name": "str", "tcp": { "auth": [{"secretRef": "str", "triggerParameter": "str"}], + "identity": "str", "metadata": {"str": "str"}, }, } ], }, - "serviceBinds": [{"name": "str", "serviceId": "str"}], + "serviceBinds": [ + {"clientType": "str", "customizedKeys": {"str": "str"}, "name": "str", "serviceId": "str"} + ], "terminationGracePeriodSeconds": 0, "volumes": [ { @@ -403,7 +455,7 @@ async def test_begin_update(self, resource_group): "type": "str", "workloadProfileName": "str", }, - api_version="2024-03-01", + api_version="2024-08-02-preview", ) ).result() # call '.result()' to poll until service return final result @@ -416,7 +468,7 @@ async def test_list_custom_host_name_analysis(self, resource_group): response = await self.client.container_apps.list_custom_host_name_analysis( resource_group_name=resource_group.name, container_app_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself @@ -428,7 +480,7 @@ async def test_list_secrets(self, resource_group): response = await self.client.container_apps.list_secrets( resource_group_name=resource_group.name, container_app_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself @@ -440,7 +492,7 @@ async def test_get_auth_token(self, resource_group): response = await self.client.container_apps.get_auth_token( resource_group_name=resource_group.name, container_app_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself @@ -453,7 +505,7 @@ async def test_begin_start(self, resource_group): await self.client.container_apps.begin_start( resource_group_name=resource_group.name, container_app_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) ).result() # call '.result()' to poll until service return final result @@ -467,7 +519,7 @@ async def test_begin_stop(self, resource_group): await self.client.container_apps.begin_stop( resource_group_name=resource_group.name, container_app_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) ).result() # call '.result()' to poll until service return final result diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_patches_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_patches_operations.py new file mode 100644 index 000000000000..066218350cda --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_patches_operations.py @@ -0,0 +1,84 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIContainerAppsPatchesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_container_app(self, resource_group): + response = self.client.container_apps_patches.list_by_container_app( + resource_group_name=resource_group.name, + container_app_name="str", + api_version="2024-08-02-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.container_apps_patches.get( + resource_group_name=resource_group.name, + container_app_name="str", + patch_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.container_apps_patches.begin_delete( + resource_group_name=resource_group.name, + container_app_name="str", + patch_name="str", + api_version="2024-08-02-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_skip_configure(self, resource_group): + response = self.client.container_apps_patches.begin_skip_configure( + resource_group_name=resource_group.name, + container_app_name="str", + patch_name="str", + patch_skip_config={"skip": bool}, + api_version="2024-08-02-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_apply(self, resource_group): + response = self.client.container_apps_patches.begin_apply( + resource_group_name=resource_group.name, + container_app_name="str", + patch_name="str", + api_version="2024-08-02-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_patches_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_patches_operations_async.py new file mode 100644 index 000000000000..ceffcba02976 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_patches_operations_async.py @@ -0,0 +1,91 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIContainerAppsPatchesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_container_app(self, resource_group): + response = self.client.container_apps_patches.list_by_container_app( + resource_group_name=resource_group.name, + container_app_name="str", + api_version="2024-08-02-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.container_apps_patches.get( + resource_group_name=resource_group.name, + container_app_name="str", + patch_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.container_apps_patches.begin_delete( + resource_group_name=resource_group.name, + container_app_name="str", + patch_name="str", + api_version="2024-08-02-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_skip_configure(self, resource_group): + response = await ( + await self.client.container_apps_patches.begin_skip_configure( + resource_group_name=resource_group.name, + container_app_name="str", + patch_name="str", + patch_skip_config={"skip": bool}, + api_version="2024-08-02-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_apply(self, resource_group): + response = await ( + await self.client.container_apps_patches.begin_apply( + resource_group_name=resource_group.name, + container_app_name="str", + patch_name="str", + api_version="2024-08-02-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_revision_replicas_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_revision_replicas_operations.py index 68a3485ac903..2a146342491d 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_revision_replicas_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_revision_replicas_operations.py @@ -26,7 +26,7 @@ def test_get_replica(self, resource_group): container_app_name="str", revision_name="str", replica_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself @@ -39,7 +39,7 @@ def test_list_replicas(self, resource_group): resource_group_name=resource_group.name, container_app_name="str", revision_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_revision_replicas_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_revision_replicas_operations_async.py index d0b7c534e654..2057852c3796 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_revision_replicas_operations_async.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_revision_replicas_operations_async.py @@ -27,7 +27,7 @@ async def test_get_replica(self, resource_group): container_app_name="str", revision_name="str", replica_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself @@ -40,7 +40,7 @@ async def test_list_replicas(self, resource_group): resource_group_name=resource_group.name, container_app_name="str", revision_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_revisions_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_revisions_operations.py index 4223cedc2daa..94d92dbc0bfb 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_revisions_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_revisions_operations.py @@ -24,7 +24,7 @@ def test_list_revisions(self, resource_group): response = self.client.container_apps_revisions.list_revisions( resource_group_name=resource_group.name, container_app_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -37,7 +37,7 @@ def test_get_revision(self, resource_group): resource_group_name=resource_group.name, container_app_name="str", revision_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself @@ -50,7 +50,7 @@ def test_activate_revision(self, resource_group): resource_group_name=resource_group.name, container_app_name="str", revision_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself @@ -63,7 +63,7 @@ def test_deactivate_revision(self, resource_group): resource_group_name=resource_group.name, container_app_name="str", revision_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself @@ -76,7 +76,7 @@ def test_restart_revision(self, resource_group): resource_group_name=resource_group.name, container_app_name="str", revision_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_revisions_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_revisions_operations_async.py index 9de3f96e46c0..a1947378e9ec 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_revisions_operations_async.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_revisions_operations_async.py @@ -25,7 +25,7 @@ async def test_list_revisions(self, resource_group): response = self.client.container_apps_revisions.list_revisions( resource_group_name=resource_group.name, container_app_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -38,7 +38,7 @@ async def test_get_revision(self, resource_group): resource_group_name=resource_group.name, container_app_name="str", revision_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself @@ -51,7 +51,7 @@ async def test_activate_revision(self, resource_group): resource_group_name=resource_group.name, container_app_name="str", revision_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself @@ -64,7 +64,7 @@ async def test_deactivate_revision(self, resource_group): resource_group_name=resource_group.name, container_app_name="str", revision_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself @@ -77,7 +77,7 @@ async def test_restart_revision(self, resource_group): resource_group_name=resource_group.name, container_app_name="str", revision_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_session_pools_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_session_pools_operations.py new file mode 100644 index 000000000000..10922dbeb837 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_session_pools_operations.py @@ -0,0 +1,157 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIContainerAppsSessionPoolsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_subscription(self, resource_group): + response = self.client.container_apps_session_pools.list_by_subscription( + api_version="2024-08-02-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_resource_group(self, resource_group): + response = self.client.container_apps_session_pools.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2024-08-02-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.container_apps_session_pools.get( + resource_group_name=resource_group.name, + session_pool_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.container_apps_session_pools.begin_create_or_update( + resource_group_name=resource_group.name, + session_pool_name="str", + session_pool_envelope={ + "location": "str", + "containerType": "str", + "customContainerTemplate": { + "containers": [ + { + "args": ["str"], + "command": ["str"], + "env": [{"name": "str", "secretRef": "str", "value": "str"}], + "image": "str", + "name": "str", + "resources": {"cpu": 0.0, "memory": "str"}, + } + ], + "ingress": {"targetPort": 0}, + "registryCredentials": { + "identity": "str", + "passwordSecretRef": "str", + "server": "str", + "username": "str", + }, + }, + "dynamicPoolConfiguration": {"cooldownPeriodInSeconds": 0, "executionType": "str"}, + "environmentId": "str", + "id": "str", + "name": "str", + "nodeCount": 0, + "poolManagementEndpoint": "str", + "poolManagementType": "str", + "provisioningState": "str", + "scaleConfiguration": {"maxConcurrentSessions": 0, "readySessionInstances": 0}, + "secrets": [{"name": "str", "value": "str"}], + "sessionNetworkConfiguration": {"status": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2024-08-02-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_update(self, resource_group): + response = self.client.container_apps_session_pools.begin_update( + resource_group_name=resource_group.name, + session_pool_name="str", + session_pool_envelope={ + "customContainerTemplate": { + "containers": [ + { + "args": ["str"], + "command": ["str"], + "env": [{"name": "str", "secretRef": "str", "value": "str"}], + "image": "str", + "name": "str", + "resources": {"cpu": 0.0, "memory": "str"}, + } + ], + "ingress": {"targetPort": 0}, + "registryCredentials": { + "identity": "str", + "passwordSecretRef": "str", + "server": "str", + "username": "str", + }, + }, + "dynamicPoolConfiguration": {"cooldownPeriodInSeconds": 0, "executionType": "str"}, + "scaleConfiguration": {"maxConcurrentSessions": 0, "readySessionInstances": 0}, + "secrets": [{"name": "str", "value": "str"}], + "sessionNetworkConfiguration": {"status": "str"}, + }, + api_version="2024-08-02-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.container_apps_session_pools.begin_delete( + resource_group_name=resource_group.name, + session_pool_name="str", + api_version="2024-08-02-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_session_pools_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_session_pools_operations_async.py new file mode 100644 index 000000000000..e621004b8fad --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_session_pools_operations_async.py @@ -0,0 +1,164 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIContainerAppsSessionPoolsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_subscription(self, resource_group): + response = self.client.container_apps_session_pools.list_by_subscription( + api_version="2024-08-02-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_resource_group(self, resource_group): + response = self.client.container_apps_session_pools.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2024-08-02-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.container_apps_session_pools.get( + resource_group_name=resource_group.name, + session_pool_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.container_apps_session_pools.begin_create_or_update( + resource_group_name=resource_group.name, + session_pool_name="str", + session_pool_envelope={ + "location": "str", + "containerType": "str", + "customContainerTemplate": { + "containers": [ + { + "args": ["str"], + "command": ["str"], + "env": [{"name": "str", "secretRef": "str", "value": "str"}], + "image": "str", + "name": "str", + "resources": {"cpu": 0.0, "memory": "str"}, + } + ], + "ingress": {"targetPort": 0}, + "registryCredentials": { + "identity": "str", + "passwordSecretRef": "str", + "server": "str", + "username": "str", + }, + }, + "dynamicPoolConfiguration": {"cooldownPeriodInSeconds": 0, "executionType": "str"}, + "environmentId": "str", + "id": "str", + "name": "str", + "nodeCount": 0, + "poolManagementEndpoint": "str", + "poolManagementType": "str", + "provisioningState": "str", + "scaleConfiguration": {"maxConcurrentSessions": 0, "readySessionInstances": 0}, + "secrets": [{"name": "str", "value": "str"}], + "sessionNetworkConfiguration": {"status": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2024-08-02-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_update(self, resource_group): + response = await ( + await self.client.container_apps_session_pools.begin_update( + resource_group_name=resource_group.name, + session_pool_name="str", + session_pool_envelope={ + "customContainerTemplate": { + "containers": [ + { + "args": ["str"], + "command": ["str"], + "env": [{"name": "str", "secretRef": "str", "value": "str"}], + "image": "str", + "name": "str", + "resources": {"cpu": 0.0, "memory": "str"}, + } + ], + "ingress": {"targetPort": 0}, + "registryCredentials": { + "identity": "str", + "passwordSecretRef": "str", + "server": "str", + "username": "str", + }, + }, + "dynamicPoolConfiguration": {"cooldownPeriodInSeconds": 0, "executionType": "str"}, + "scaleConfiguration": {"maxConcurrentSessions": 0, "readySessionInstances": 0}, + "secrets": [{"name": "str", "value": "str"}], + "sessionNetworkConfiguration": {"status": "str"}, + }, + api_version="2024-08-02-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.container_apps_session_pools.begin_delete( + resource_group_name=resource_group.name, + session_pool_name="str", + api_version="2024-08-02-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_source_controls_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_source_controls_operations.py index fdce9d3156fa..d1c3378482b3 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_source_controls_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_source_controls_operations.py @@ -24,7 +24,7 @@ def test_list_by_container_app(self, resource_group): response = self.client.container_apps_source_controls.list_by_container_app( resource_group_name=resource_group.name, container_app_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -37,7 +37,7 @@ def test_get(self, resource_group): resource_group_name=resource_group.name, container_app_name="str", source_control_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself @@ -60,7 +60,9 @@ def test_begin_create_or_update(self, resource_group): "subscriptionId": "str", "tenantId": "str", }, + "buildEnvironmentVariables": [{"name": "str", "value": "str"}], "contextPath": "str", + "dockerfilePath": "str", "githubPersonalAccessToken": "str", "image": "str", "os": "str", @@ -83,7 +85,7 @@ def test_begin_create_or_update(self, resource_group): }, "type": "str", }, - api_version="2024-03-01", + api_version="2024-08-02-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -96,7 +98,7 @@ def test_begin_delete(self, resource_group): resource_group_name=resource_group.name, container_app_name="str", source_control_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_source_controls_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_source_controls_operations_async.py index 08788e157cf6..e7bdc90db6a5 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_source_controls_operations_async.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_container_apps_source_controls_operations_async.py @@ -25,7 +25,7 @@ async def test_list_by_container_app(self, resource_group): response = self.client.container_apps_source_controls.list_by_container_app( resource_group_name=resource_group.name, container_app_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -38,7 +38,7 @@ async def test_get(self, resource_group): resource_group_name=resource_group.name, container_app_name="str", source_control_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself @@ -62,7 +62,9 @@ async def test_begin_create_or_update(self, resource_group): "subscriptionId": "str", "tenantId": "str", }, + "buildEnvironmentVariables": [{"name": "str", "value": "str"}], "contextPath": "str", + "dockerfilePath": "str", "githubPersonalAccessToken": "str", "image": "str", "os": "str", @@ -85,7 +87,7 @@ async def test_begin_create_or_update(self, resource_group): }, "type": "str", }, - api_version="2024-03-01", + api_version="2024-08-02-preview", ) ).result() # call '.result()' to poll until service return final result @@ -100,7 +102,7 @@ async def test_begin_delete(self, resource_group): resource_group_name=resource_group.name, container_app_name="str", source_control_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) ).result() # call '.result()' to poll until service return final result diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dapr_component_resiliency_policies_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dapr_component_resiliency_policies_operations.py new file mode 100644 index 000000000000..3147d365491d --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dapr_component_resiliency_policies_operations.py @@ -0,0 +1,103 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIDaprComponentResiliencyPoliciesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.dapr_component_resiliency_policies.list( + resource_group_name=resource_group.name, + environment_name="str", + component_name="str", + api_version="2024-08-02-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.dapr_component_resiliency_policies.get( + resource_group_name=resource_group.name, + environment_name="str", + component_name="str", + name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update(self, resource_group): + response = self.client.dapr_component_resiliency_policies.create_or_update( + resource_group_name=resource_group.name, + environment_name="str", + component_name="str", + name="str", + dapr_component_resiliency_policy_envelope={ + "id": "str", + "inboundPolicy": { + "circuitBreakerPolicy": {"consecutiveErrors": 0, "intervalInSeconds": 0, "timeoutInSeconds": 0}, + "httpRetryPolicy": { + "maxRetries": 0, + "retryBackOff": {"initialDelayInMilliseconds": 0, "maxIntervalInMilliseconds": 0}, + }, + "timeoutPolicy": {"responseTimeoutInSeconds": 0}, + }, + "name": "str", + "outboundPolicy": { + "circuitBreakerPolicy": {"consecutiveErrors": 0, "intervalInSeconds": 0, "timeoutInSeconds": 0}, + "httpRetryPolicy": { + "maxRetries": 0, + "retryBackOff": {"initialDelayInMilliseconds": 0, "maxIntervalInMilliseconds": 0}, + }, + "timeoutPolicy": {"responseTimeoutInSeconds": 0}, + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete(self, resource_group): + response = self.client.dapr_component_resiliency_policies.delete( + resource_group_name=resource_group.name, + environment_name="str", + component_name="str", + name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dapr_component_resiliency_policies_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dapr_component_resiliency_policies_operations_async.py new file mode 100644 index 000000000000..fc06f53a0604 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dapr_component_resiliency_policies_operations_async.py @@ -0,0 +1,104 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIDaprComponentResiliencyPoliciesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.dapr_component_resiliency_policies.list( + resource_group_name=resource_group.name, + environment_name="str", + component_name="str", + api_version="2024-08-02-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.dapr_component_resiliency_policies.get( + resource_group_name=resource_group.name, + environment_name="str", + component_name="str", + name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update(self, resource_group): + response = await self.client.dapr_component_resiliency_policies.create_or_update( + resource_group_name=resource_group.name, + environment_name="str", + component_name="str", + name="str", + dapr_component_resiliency_policy_envelope={ + "id": "str", + "inboundPolicy": { + "circuitBreakerPolicy": {"consecutiveErrors": 0, "intervalInSeconds": 0, "timeoutInSeconds": 0}, + "httpRetryPolicy": { + "maxRetries": 0, + "retryBackOff": {"initialDelayInMilliseconds": 0, "maxIntervalInMilliseconds": 0}, + }, + "timeoutPolicy": {"responseTimeoutInSeconds": 0}, + }, + "name": "str", + "outboundPolicy": { + "circuitBreakerPolicy": {"consecutiveErrors": 0, "intervalInSeconds": 0, "timeoutInSeconds": 0}, + "httpRetryPolicy": { + "maxRetries": 0, + "retryBackOff": {"initialDelayInMilliseconds": 0, "maxIntervalInMilliseconds": 0}, + }, + "timeoutPolicy": {"responseTimeoutInSeconds": 0}, + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete(self, resource_group): + response = await self.client.dapr_component_resiliency_policies.delete( + resource_group_name=resource_group.name, + environment_name="str", + component_name="str", + name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dapr_components_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dapr_components_operations.py index 8d774741aa16..bbd3070f070f 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dapr_components_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dapr_components_operations.py @@ -24,7 +24,7 @@ def test_list(self, resource_group): response = self.client.dapr_components.list( resource_group_name=resource_group.name, environment_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -37,7 +37,7 @@ def test_get(self, resource_group): resource_group_name=resource_group.name, environment_name="str", component_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself @@ -60,6 +60,9 @@ def test_create_or_update(self, resource_group): "scopes": ["str"], "secretStoreComponent": "str", "secrets": [{"identity": "str", "keyVaultUrl": "str", "name": "str", "value": "str"}], + "serviceComponentBind": [ + {"metadata": {"name": "str", "value": "str"}, "name": "str", "serviceId": "str"} + ], "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -71,7 +74,7 @@ def test_create_or_update(self, resource_group): "type": "str", "version": "str", }, - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself @@ -84,7 +87,7 @@ def test_delete(self, resource_group): resource_group_name=resource_group.name, environment_name="str", component_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself @@ -97,7 +100,7 @@ def test_list_secrets(self, resource_group): resource_group_name=resource_group.name, environment_name="str", component_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dapr_components_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dapr_components_operations_async.py index fa5ed26ad6c2..59f9d86584b9 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dapr_components_operations_async.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dapr_components_operations_async.py @@ -25,7 +25,7 @@ async def test_list(self, resource_group): response = self.client.dapr_components.list( resource_group_name=resource_group.name, environment_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -38,7 +38,7 @@ async def test_get(self, resource_group): resource_group_name=resource_group.name, environment_name="str", component_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself @@ -61,6 +61,9 @@ async def test_create_or_update(self, resource_group): "scopes": ["str"], "secretStoreComponent": "str", "secrets": [{"identity": "str", "keyVaultUrl": "str", "name": "str", "value": "str"}], + "serviceComponentBind": [ + {"metadata": {"name": "str", "value": "str"}, "name": "str", "serviceId": "str"} + ], "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -72,7 +75,7 @@ async def test_create_or_update(self, resource_group): "type": "str", "version": "str", }, - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself @@ -85,7 +88,7 @@ async def test_delete(self, resource_group): resource_group_name=resource_group.name, environment_name="str", component_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself @@ -98,7 +101,7 @@ async def test_list_secrets(self, resource_group): resource_group_name=resource_group.name, environment_name="str", component_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dapr_subscriptions_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dapr_subscriptions_operations.py new file mode 100644 index 000000000000..49197250bc40 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dapr_subscriptions_operations.py @@ -0,0 +1,90 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIDaprSubscriptionsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.dapr_subscriptions.list( + resource_group_name=resource_group.name, + environment_name="str", + api_version="2024-08-02-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.dapr_subscriptions.get( + resource_group_name=resource_group.name, + environment_name="str", + name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update(self, resource_group): + response = self.client.dapr_subscriptions.create_or_update( + resource_group_name=resource_group.name, + environment_name="str", + name="str", + dapr_subscription_envelope={ + "bulkSubscribe": {"enabled": False, "maxAwaitDurationMs": 0, "maxMessagesCount": 0}, + "deadLetterTopic": "str", + "id": "str", + "metadata": {"str": "str"}, + "name": "str", + "pubsubName": "str", + "routes": {"default": "str", "rules": [{"match": "str", "path": "str"}]}, + "scopes": ["str"], + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "topic": "str", + "type": "str", + }, + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete(self, resource_group): + response = self.client.dapr_subscriptions.delete( + resource_group_name=resource_group.name, + environment_name="str", + name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dapr_subscriptions_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dapr_subscriptions_operations_async.py new file mode 100644 index 000000000000..9038a3c23b75 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dapr_subscriptions_operations_async.py @@ -0,0 +1,91 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIDaprSubscriptionsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.dapr_subscriptions.list( + resource_group_name=resource_group.name, + environment_name="str", + api_version="2024-08-02-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.dapr_subscriptions.get( + resource_group_name=resource_group.name, + environment_name="str", + name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update(self, resource_group): + response = await self.client.dapr_subscriptions.create_or_update( + resource_group_name=resource_group.name, + environment_name="str", + name="str", + dapr_subscription_envelope={ + "bulkSubscribe": {"enabled": False, "maxAwaitDurationMs": 0, "maxMessagesCount": 0}, + "deadLetterTopic": "str", + "id": "str", + "metadata": {"str": "str"}, + "name": "str", + "pubsubName": "str", + "routes": {"default": "str", "rules": [{"match": "str", "path": "str"}]}, + "scopes": ["str"], + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "topic": "str", + "type": "str", + }, + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete(self, resource_group): + response = await self.client.dapr_subscriptions.delete( + resource_group_name=resource_group.name, + environment_name="str", + name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dot_net_components_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dot_net_components_operations.py new file mode 100644 index 000000000000..72a4e436436f --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dot_net_components_operations.py @@ -0,0 +1,117 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIDotNetComponentsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.dot_net_components.list( + resource_group_name=resource_group.name, + environment_name="str", + api_version="2024-08-02-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.dot_net_components.get( + resource_group_name=resource_group.name, + environment_name="str", + name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.dot_net_components.begin_create_or_update( + resource_group_name=resource_group.name, + environment_name="str", + name="str", + dot_net_component_envelope={ + "componentType": "str", + "configurations": [{"propertyName": "str", "value": "str"}], + "id": "str", + "name": "str", + "provisioningState": "str", + "serviceBinds": [{"name": "str", "serviceId": "str"}], + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-08-02-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_update(self, resource_group): + response = self.client.dot_net_components.begin_update( + resource_group_name=resource_group.name, + environment_name="str", + name="str", + dot_net_component_envelope={ + "componentType": "str", + "configurations": [{"propertyName": "str", "value": "str"}], + "id": "str", + "name": "str", + "provisioningState": "str", + "serviceBinds": [{"name": "str", "serviceId": "str"}], + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-08-02-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.dot_net_components.begin_delete( + resource_group_name=resource_group.name, + environment_name="str", + name="str", + api_version="2024-08-02-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dot_net_components_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dot_net_components_operations_async.py new file mode 100644 index 000000000000..1e6a8021baa2 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_dot_net_components_operations_async.py @@ -0,0 +1,124 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIDotNetComponentsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.dot_net_components.list( + resource_group_name=resource_group.name, + environment_name="str", + api_version="2024-08-02-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.dot_net_components.get( + resource_group_name=resource_group.name, + environment_name="str", + name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.dot_net_components.begin_create_or_update( + resource_group_name=resource_group.name, + environment_name="str", + name="str", + dot_net_component_envelope={ + "componentType": "str", + "configurations": [{"propertyName": "str", "value": "str"}], + "id": "str", + "name": "str", + "provisioningState": "str", + "serviceBinds": [{"name": "str", "serviceId": "str"}], + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-08-02-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_update(self, resource_group): + response = await ( + await self.client.dot_net_components.begin_update( + resource_group_name=resource_group.name, + environment_name="str", + name="str", + dot_net_component_envelope={ + "componentType": "str", + "configurations": [{"propertyName": "str", "value": "str"}], + "id": "str", + "name": "str", + "provisioningState": "str", + "serviceBinds": [{"name": "str", "serviceId": "str"}], + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-08-02-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.dot_net_components.begin_delete( + resource_group_name=resource_group.name, + environment_name="str", + name="str", + api_version="2024-08-02-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_functions_extension_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_functions_extension_operations.py new file mode 100644 index 000000000000..743c92817f33 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_functions_extension_operations.py @@ -0,0 +1,33 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIFunctionsExtensionOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_invoke_functions_host(self, resource_group): + response = self.client.functions_extension.invoke_functions_host( + resource_group_name=resource_group.name, + container_app_name="str", + revision_name="str", + function_app_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_functions_extension_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_functions_extension_operations_async.py new file mode 100644 index 000000000000..7601b17d79b5 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_functions_extension_operations_async.py @@ -0,0 +1,34 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIFunctionsExtensionOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_invoke_functions_host(self, resource_group): + response = await self.client.functions_extension.invoke_functions_host( + resource_group_name=resource_group.name, + container_app_name="str", + revision_name="str", + function_app_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_java_components_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_java_components_operations.py new file mode 100644 index 000000000000..3e2beb5bccf3 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_java_components_operations.py @@ -0,0 +1,111 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIJavaComponentsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.java_components.list( + resource_group_name=resource_group.name, + environment_name="str", + api_version="2024-08-02-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.java_components.get( + resource_group_name=resource_group.name, + environment_name="str", + name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.java_components.begin_create_or_update( + resource_group_name=resource_group.name, + environment_name="str", + name="str", + java_component_envelope={ + "id": "str", + "name": "str", + "properties": "java_component_properties", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-08-02-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_update(self, resource_group): + response = self.client.java_components.begin_update( + resource_group_name=resource_group.name, + environment_name="str", + name="str", + java_component_envelope={ + "id": "str", + "name": "str", + "properties": "java_component_properties", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-08-02-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.java_components.begin_delete( + resource_group_name=resource_group.name, + environment_name="str", + name="str", + api_version="2024-08-02-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_java_components_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_java_components_operations_async.py new file mode 100644 index 000000000000..afe090122714 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_java_components_operations_async.py @@ -0,0 +1,118 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIJavaComponentsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.java_components.list( + resource_group_name=resource_group.name, + environment_name="str", + api_version="2024-08-02-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.java_components.get( + resource_group_name=resource_group.name, + environment_name="str", + name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.java_components.begin_create_or_update( + resource_group_name=resource_group.name, + environment_name="str", + name="str", + java_component_envelope={ + "id": "str", + "name": "str", + "properties": "java_component_properties", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-08-02-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_update(self, resource_group): + response = await ( + await self.client.java_components.begin_update( + resource_group_name=resource_group.name, + environment_name="str", + name="str", + java_component_envelope={ + "id": "str", + "name": "str", + "properties": "java_component_properties", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-08-02-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.java_components.begin_delete( + resource_group_name=resource_group.name, + environment_name="str", + name="str", + api_version="2024-08-02-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_jobs_executions_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_jobs_executions_operations.py index b5e07d699dce..c2e31ca66ea3 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_jobs_executions_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_jobs_executions_operations.py @@ -24,7 +24,7 @@ def test_list(self, resource_group): response = self.client.jobs_executions.list( resource_group_name=resource_group.name, job_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_jobs_executions_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_jobs_executions_operations_async.py index 0ef51f590a96..3bc443073725 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_jobs_executions_operations_async.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_jobs_executions_operations_async.py @@ -25,7 +25,7 @@ async def test_list(self, resource_group): response = self.client.jobs_executions.list( resource_group_name=resource_group.name, job_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_jobs_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_jobs_operations.py index 18f739347349..9f8d3be2d07f 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_jobs_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_jobs_operations.py @@ -24,7 +24,7 @@ def test_list_detectors(self, resource_group): response = self.client.jobs.list_detectors( resource_group_name=resource_group.name, job_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -37,7 +37,7 @@ def test_get_detector(self, resource_group): resource_group_name=resource_group.name, job_name="str", detector_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself @@ -50,7 +50,7 @@ def test_proxy_get(self, resource_group): resource_group_name=resource_group.name, job_name="str", api_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself @@ -60,7 +60,7 @@ def test_proxy_get(self, resource_group): @recorded_by_proxy def test_list_by_subscription(self, resource_group): response = self.client.jobs.list_by_subscription( - api_version="2024-03-01", + api_version="2024-08-02-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -71,7 +71,7 @@ def test_list_by_subscription(self, resource_group): def test_list_by_resource_group(self, resource_group): response = self.client.jobs.list_by_resource_group( resource_group_name=resource_group.name, - api_version="2024-03-01", + api_version="2024-08-02-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -83,7 +83,7 @@ def test_get(self, resource_group): response = self.client.jobs.get( resource_group_name=resource_group.name, job_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself @@ -110,6 +110,7 @@ def test_begin_create_or_update(self, resource_group): "rules": [ { "auth": [{"secretRef": "str", "triggerParameter": "str"}], + "identity": "str", "metadata": {}, "name": "str", "type": "str", @@ -117,6 +118,7 @@ def test_begin_create_or_update(self, resource_group): ], }, }, + "identitySettings": [{"identity": "str", "lifecycle": "All"}], "manualTriggerConfig": {"parallelism": 0, "replicaCompletionCount": 0}, "registries": [{"identity": "str", "passwordSecretRef": "str", "server": "str", "username": "str"}], "replicaRetryLimit": 0, @@ -125,6 +127,7 @@ def test_begin_create_or_update(self, resource_group): }, "environmentId": "str", "eventStreamEndpoint": "str", + "extendedLocation": {"name": "str", "type": "str"}, "id": "str", "identity": { "type": "str", @@ -135,6 +138,7 @@ def test_begin_create_or_update(self, resource_group): "name": "str", "outboundIpAddresses": ["str"], "provisioningState": "str", + "runningState": "str", "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -151,6 +155,7 @@ def test_begin_create_or_update(self, resource_group): "command": ["str"], "env": [{"name": "str", "secretRef": "str", "value": "str"}], "image": "str", + "imageType": "str", "name": "str", "probes": [ { @@ -181,6 +186,7 @@ def test_begin_create_or_update(self, resource_group): "command": ["str"], "env": [{"name": "str", "secretRef": "str", "value": "str"}], "image": "str", + "imageType": "str", "name": "str", "resources": {"cpu": 0.0, "ephemeralStorage": "str", "memory": "str"}, "volumeMounts": [{"mountPath": "str", "subPath": "str", "volumeName": "str"}], @@ -199,7 +205,7 @@ def test_begin_create_or_update(self, resource_group): "type": "str", "workloadProfileName": "str", }, - api_version="2024-03-01", + api_version="2024-08-02-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -211,7 +217,7 @@ def test_begin_delete(self, resource_group): response = self.client.jobs.begin_delete( resource_group_name=resource_group.name, job_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -224,6 +230,7 @@ def test_begin_update(self, resource_group): resource_group_name=resource_group.name, job_name="str", job_envelope={ + "extendedLocation": {"name": "str", "type": "str"}, "identity": { "type": "str", "principalId": "str", @@ -244,6 +251,7 @@ def test_begin_update(self, resource_group): "rules": [ { "auth": [{"secretRef": "str", "triggerParameter": "str"}], + "identity": "str", "metadata": {}, "name": "str", "type": "str", @@ -251,6 +259,7 @@ def test_begin_update(self, resource_group): ], }, }, + "identitySettings": [{"identity": "str", "lifecycle": "All"}], "manualTriggerConfig": {"parallelism": 0, "replicaCompletionCount": 0}, "registries": [ {"identity": "str", "passwordSecretRef": "str", "server": "str", "username": "str"} @@ -273,6 +282,7 @@ def test_begin_update(self, resource_group): "command": ["str"], "env": [{"name": "str", "secretRef": "str", "value": "str"}], "image": "str", + "imageType": "str", "name": "str", "probes": [ { @@ -303,6 +313,7 @@ def test_begin_update(self, resource_group): "command": ["str"], "env": [{"name": "str", "secretRef": "str", "value": "str"}], "image": "str", + "imageType": "str", "name": "str", "resources": {"cpu": 0.0, "ephemeralStorage": "str", "memory": "str"}, "volumeMounts": [{"mountPath": "str", "subPath": "str", "volumeName": "str"}], @@ -321,7 +332,7 @@ def test_begin_update(self, resource_group): }, "tags": {"str": "str"}, }, - api_version="2024-03-01", + api_version="2024-08-02-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -333,7 +344,7 @@ def test_begin_start(self, resource_group): response = self.client.jobs.begin_start( resource_group_name=resource_group.name, job_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -346,7 +357,7 @@ def test_begin_stop_execution(self, resource_group): resource_group_name=resource_group.name, job_name="str", job_execution_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -358,7 +369,7 @@ def test_begin_stop_multiple_executions(self, resource_group): response = self.client.jobs.begin_stop_multiple_executions( resource_group_name=resource_group.name, job_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -370,8 +381,32 @@ def test_list_secrets(self, resource_group): response = self.client.jobs.list_secrets( resource_group_name=resource_group.name, job_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_resume(self, resource_group): + response = self.client.jobs.begin_resume( + resource_group_name=resource_group.name, + job_name="str", + api_version="2024-08-02-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_suspend(self, resource_group): + response = self.client.jobs.begin_suspend( + resource_group_name=resource_group.name, + job_name="str", + api_version="2024-08-02-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_jobs_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_jobs_operations_async.py index 07737e683da4..09e16b1e7465 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_jobs_operations_async.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_jobs_operations_async.py @@ -25,7 +25,7 @@ async def test_list_detectors(self, resource_group): response = self.client.jobs.list_detectors( resource_group_name=resource_group.name, job_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -38,7 +38,7 @@ async def test_get_detector(self, resource_group): resource_group_name=resource_group.name, job_name="str", detector_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself @@ -51,7 +51,7 @@ async def test_proxy_get(self, resource_group): resource_group_name=resource_group.name, job_name="str", api_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself @@ -61,7 +61,7 @@ async def test_proxy_get(self, resource_group): @recorded_by_proxy_async async def test_list_by_subscription(self, resource_group): response = self.client.jobs.list_by_subscription( - api_version="2024-03-01", + api_version="2024-08-02-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -72,7 +72,7 @@ async def test_list_by_subscription(self, resource_group): async def test_list_by_resource_group(self, resource_group): response = self.client.jobs.list_by_resource_group( resource_group_name=resource_group.name, - api_version="2024-03-01", + api_version="2024-08-02-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -84,7 +84,7 @@ async def test_get(self, resource_group): response = await self.client.jobs.get( resource_group_name=resource_group.name, job_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself @@ -112,6 +112,7 @@ async def test_begin_create_or_update(self, resource_group): "rules": [ { "auth": [{"secretRef": "str", "triggerParameter": "str"}], + "identity": "str", "metadata": {}, "name": "str", "type": "str", @@ -119,6 +120,7 @@ async def test_begin_create_or_update(self, resource_group): ], }, }, + "identitySettings": [{"identity": "str", "lifecycle": "All"}], "manualTriggerConfig": {"parallelism": 0, "replicaCompletionCount": 0}, "registries": [ {"identity": "str", "passwordSecretRef": "str", "server": "str", "username": "str"} @@ -133,6 +135,7 @@ async def test_begin_create_or_update(self, resource_group): }, "environmentId": "str", "eventStreamEndpoint": "str", + "extendedLocation": {"name": "str", "type": "str"}, "id": "str", "identity": { "type": "str", @@ -143,6 +146,7 @@ async def test_begin_create_or_update(self, resource_group): "name": "str", "outboundIpAddresses": ["str"], "provisioningState": "str", + "runningState": "str", "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -159,6 +163,7 @@ async def test_begin_create_or_update(self, resource_group): "command": ["str"], "env": [{"name": "str", "secretRef": "str", "value": "str"}], "image": "str", + "imageType": "str", "name": "str", "probes": [ { @@ -189,6 +194,7 @@ async def test_begin_create_or_update(self, resource_group): "command": ["str"], "env": [{"name": "str", "secretRef": "str", "value": "str"}], "image": "str", + "imageType": "str", "name": "str", "resources": {"cpu": 0.0, "ephemeralStorage": "str", "memory": "str"}, "volumeMounts": [{"mountPath": "str", "subPath": "str", "volumeName": "str"}], @@ -207,7 +213,7 @@ async def test_begin_create_or_update(self, resource_group): "type": "str", "workloadProfileName": "str", }, - api_version="2024-03-01", + api_version="2024-08-02-preview", ) ).result() # call '.result()' to poll until service return final result @@ -221,7 +227,7 @@ async def test_begin_delete(self, resource_group): await self.client.jobs.begin_delete( resource_group_name=resource_group.name, job_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) ).result() # call '.result()' to poll until service return final result @@ -236,6 +242,7 @@ async def test_begin_update(self, resource_group): resource_group_name=resource_group.name, job_name="str", job_envelope={ + "extendedLocation": {"name": "str", "type": "str"}, "identity": { "type": "str", "principalId": "str", @@ -256,6 +263,7 @@ async def test_begin_update(self, resource_group): "rules": [ { "auth": [{"secretRef": "str", "triggerParameter": "str"}], + "identity": "str", "metadata": {}, "name": "str", "type": "str", @@ -263,6 +271,7 @@ async def test_begin_update(self, resource_group): ], }, }, + "identitySettings": [{"identity": "str", "lifecycle": "All"}], "manualTriggerConfig": {"parallelism": 0, "replicaCompletionCount": 0}, "registries": [ {"identity": "str", "passwordSecretRef": "str", "server": "str", "username": "str"} @@ -285,6 +294,7 @@ async def test_begin_update(self, resource_group): "command": ["str"], "env": [{"name": "str", "secretRef": "str", "value": "str"}], "image": "str", + "imageType": "str", "name": "str", "probes": [ { @@ -315,6 +325,7 @@ async def test_begin_update(self, resource_group): "command": ["str"], "env": [{"name": "str", "secretRef": "str", "value": "str"}], "image": "str", + "imageType": "str", "name": "str", "resources": {"cpu": 0.0, "ephemeralStorage": "str", "memory": "str"}, "volumeMounts": [{"mountPath": "str", "subPath": "str", "volumeName": "str"}], @@ -333,7 +344,7 @@ async def test_begin_update(self, resource_group): }, "tags": {"str": "str"}, }, - api_version="2024-03-01", + api_version="2024-08-02-preview", ) ).result() # call '.result()' to poll until service return final result @@ -347,7 +358,7 @@ async def test_begin_start(self, resource_group): await self.client.jobs.begin_start( resource_group_name=resource_group.name, job_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) ).result() # call '.result()' to poll until service return final result @@ -362,7 +373,7 @@ async def test_begin_stop_execution(self, resource_group): resource_group_name=resource_group.name, job_name="str", job_execution_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) ).result() # call '.result()' to poll until service return final result @@ -376,7 +387,7 @@ async def test_begin_stop_multiple_executions(self, resource_group): await self.client.jobs.begin_stop_multiple_executions( resource_group_name=resource_group.name, job_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) ).result() # call '.result()' to poll until service return final result @@ -389,8 +400,36 @@ async def test_list_secrets(self, resource_group): response = await self.client.jobs.list_secrets( resource_group_name=resource_group.name, job_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_resume(self, resource_group): + response = await ( + await self.client.jobs.begin_resume( + resource_group_name=resource_group.name, + job_name="str", + api_version="2024-08-02-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_suspend(self, resource_group): + response = await ( + await self.client.jobs.begin_suspend( + resource_group_name=resource_group.name, + job_name="str", + api_version="2024-08-02-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_logic_apps_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_logic_apps_operations.py new file mode 100644 index 000000000000..1d4536c74063 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_logic_apps_operations.py @@ -0,0 +1,140 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPILogicAppsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.logic_apps.get( + resource_group_name=resource_group.name, + container_app_name="str", + logic_app_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update(self, resource_group): + response = self.client.logic_apps.create_or_update( + resource_group_name=resource_group.name, + container_app_name="str", + logic_app_name="str", + resource={ + "id": "str", + "name": "str", + "properties": {}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete(self, resource_group): + response = self.client.logic_apps.delete( + resource_group_name=resource_group.name, + container_app_name="str", + logic_app_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_workflows(self, resource_group): + response = self.client.logic_apps.list_workflows( + resource_group_name=resource_group.name, + container_app_name="str", + logic_app_name="str", + api_version="2024-08-02-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_workflow(self, resource_group): + response = self.client.logic_apps.get_workflow( + resource_group_name=resource_group.name, + container_app_name="str", + logic_app_name="str", + workflow_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_deploy_workflow_artifacts(self, resource_group): + response = self.client.logic_apps.deploy_workflow_artifacts( + resource_group_name=resource_group.name, + container_app_name="str", + logic_app_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_workflows_connections(self, resource_group): + response = self.client.logic_apps.list_workflows_connections( + resource_group_name=resource_group.name, + container_app_name="str", + logic_app_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_invoke(self, resource_group): + response = self.client.logic_apps.invoke( + resource_group_name=resource_group.name, + container_app_name="str", + logic_app_name="str", + x_ms_logic_apps_proxy_path="str", + x_ms_logic_apps_proxy_method="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_logic_apps_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_logic_apps_operations_async.py new file mode 100644 index 000000000000..76a868a54901 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_logic_apps_operations_async.py @@ -0,0 +1,141 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPILogicAppsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.logic_apps.get( + resource_group_name=resource_group.name, + container_app_name="str", + logic_app_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update(self, resource_group): + response = await self.client.logic_apps.create_or_update( + resource_group_name=resource_group.name, + container_app_name="str", + logic_app_name="str", + resource={ + "id": "str", + "name": "str", + "properties": {}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete(self, resource_group): + response = await self.client.logic_apps.delete( + resource_group_name=resource_group.name, + container_app_name="str", + logic_app_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_workflows(self, resource_group): + response = self.client.logic_apps.list_workflows( + resource_group_name=resource_group.name, + container_app_name="str", + logic_app_name="str", + api_version="2024-08-02-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_workflow(self, resource_group): + response = await self.client.logic_apps.get_workflow( + resource_group_name=resource_group.name, + container_app_name="str", + logic_app_name="str", + workflow_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_deploy_workflow_artifacts(self, resource_group): + response = await self.client.logic_apps.deploy_workflow_artifacts( + resource_group_name=resource_group.name, + container_app_name="str", + logic_app_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_workflows_connections(self, resource_group): + response = await self.client.logic_apps.list_workflows_connections( + resource_group_name=resource_group.name, + container_app_name="str", + logic_app_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_invoke(self, resource_group): + response = await self.client.logic_apps.invoke( + resource_group_name=resource_group.name, + container_app_name="str", + logic_app_name="str", + x_ms_logic_apps_proxy_path="str", + x_ms_logic_apps_proxy_method="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_certificates_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_certificates_operations.py index c7067137fd90..15cb79a15a31 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_certificates_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_certificates_operations.py @@ -25,7 +25,7 @@ def test_get(self, resource_group): resource_group_name=resource_group.name, environment_name="str", managed_certificate_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself @@ -38,7 +38,7 @@ def test_begin_create_or_update(self, resource_group): resource_group_name=resource_group.name, environment_name="str", managed_certificate_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -51,7 +51,7 @@ def test_delete(self, resource_group): resource_group_name=resource_group.name, environment_name="str", managed_certificate_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself @@ -65,7 +65,7 @@ def test_update(self, resource_group): environment_name="str", managed_certificate_name="str", managed_certificate_envelope={"tags": {"str": "str"}}, - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself @@ -77,7 +77,7 @@ def test_list(self, resource_group): response = self.client.managed_certificates.list( resource_group_name=resource_group.name, environment_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_certificates_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_certificates_operations_async.py index 5f1ba6b1f5d8..aa2880913e1e 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_certificates_operations_async.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_certificates_operations_async.py @@ -26,7 +26,7 @@ async def test_get(self, resource_group): resource_group_name=resource_group.name, environment_name="str", managed_certificate_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself @@ -40,7 +40,7 @@ async def test_begin_create_or_update(self, resource_group): resource_group_name=resource_group.name, environment_name="str", managed_certificate_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) ).result() # call '.result()' to poll until service return final result @@ -54,7 +54,7 @@ async def test_delete(self, resource_group): resource_group_name=resource_group.name, environment_name="str", managed_certificate_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself @@ -68,7 +68,7 @@ async def test_update(self, resource_group): environment_name="str", managed_certificate_name="str", managed_certificate_envelope={"tags": {"str": "str"}}, - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself @@ -80,7 +80,7 @@ async def test_list(self, resource_group): response = self.client.managed_certificates.list( resource_group_name=resource_group.name, environment_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_diagnostics_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_diagnostics_operations.py index 642873ae7bfe..e99594c282e9 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_diagnostics_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_diagnostics_operations.py @@ -24,7 +24,7 @@ def test_list_detectors(self, resource_group): response = self.client.managed_environment_diagnostics.list_detectors( resource_group_name=resource_group.name, environment_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself @@ -37,7 +37,7 @@ def test_get_detector(self, resource_group): resource_group_name=resource_group.name, environment_name="str", detector_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_diagnostics_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_diagnostics_operations_async.py index d8bee226eb4f..b9e3e94e8464 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_diagnostics_operations_async.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_diagnostics_operations_async.py @@ -25,7 +25,7 @@ async def test_list_detectors(self, resource_group): response = await self.client.managed_environment_diagnostics.list_detectors( resource_group_name=resource_group.name, environment_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself @@ -38,7 +38,7 @@ async def test_get_detector(self, resource_group): resource_group_name=resource_group.name, environment_name="str", detector_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_private_endpoint_connections_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_private_endpoint_connections_operations.py new file mode 100644 index 000000000000..44b9aa6dbcc2 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_private_endpoint_connections_operations.py @@ -0,0 +1,87 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIManagedEnvironmentPrivateEndpointConnectionsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.managed_environment_private_endpoint_connections.list( + resource_group_name=resource_group.name, + environment_name="str", + api_version="2024-08-02-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.managed_environment_private_endpoint_connections.get( + resource_group_name=resource_group.name, + environment_name="str", + private_endpoint_connection_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.managed_environment_private_endpoint_connections.begin_create_or_update( + resource_group_name=resource_group.name, + environment_name="str", + private_endpoint_connection_name="str", + private_endpoint_connection_envelope={ + "groupIds": ["str"], + "id": "str", + "name": "str", + "privateEndpoint": {"id": "str"}, + "privateLinkServiceConnectionState": {"actionsRequired": "str", "description": "str", "status": "str"}, + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-08-02-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.managed_environment_private_endpoint_connections.begin_delete( + resource_group_name=resource_group.name, + environment_name="str", + private_endpoint_connection_name="str", + api_version="2024-08-02-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_private_endpoint_connections_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_private_endpoint_connections_operations_async.py new file mode 100644 index 000000000000..ea026b11caf3 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_private_endpoint_connections_operations_async.py @@ -0,0 +1,96 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIManagedEnvironmentPrivateEndpointConnectionsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.managed_environment_private_endpoint_connections.list( + resource_group_name=resource_group.name, + environment_name="str", + api_version="2024-08-02-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.managed_environment_private_endpoint_connections.get( + resource_group_name=resource_group.name, + environment_name="str", + private_endpoint_connection_name="str", + api_version="2024-08-02-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.managed_environment_private_endpoint_connections.begin_create_or_update( + resource_group_name=resource_group.name, + environment_name="str", + private_endpoint_connection_name="str", + private_endpoint_connection_envelope={ + "groupIds": ["str"], + "id": "str", + "name": "str", + "privateEndpoint": {"id": "str"}, + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-08-02-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.managed_environment_private_endpoint_connections.begin_delete( + resource_group_name=resource_group.name, + environment_name="str", + private_endpoint_connection_name="str", + api_version="2024-08-02-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_private_link_resources_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_private_link_resources_operations.py new file mode 100644 index 000000000000..297c7238aa80 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_private_link_resources_operations.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIManagedEnvironmentPrivateLinkResourcesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.managed_environment_private_link_resources.list( + resource_group_name=resource_group.name, + environment_name="str", + api_version="2024-08-02-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_private_link_resources_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_private_link_resources_operations_async.py new file mode 100644 index 000000000000..74a629c4ff43 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_private_link_resources_operations_async.py @@ -0,0 +1,32 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.appcontainers.aio import ContainerAppsAPIClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestContainerAppsAPIManagedEnvironmentPrivateLinkResourcesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ContainerAppsAPIClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.managed_environment_private_link_resources.list( + resource_group_name=resource_group.name, + environment_name="str", + api_version="2024-08-02-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_usages_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_usages_operations.py index 89a46c6bdae7..849c8b722162 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_usages_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_usages_operations.py @@ -24,7 +24,7 @@ def test_list(self, resource_group): response = self.client.managed_environment_usages.list( resource_group_name=resource_group.name, environment_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_usages_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_usages_operations_async.py index 66b6e816f9c9..92e527da68b4 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_usages_operations_async.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environment_usages_operations_async.py @@ -25,7 +25,7 @@ async def test_list(self, resource_group): response = self.client.managed_environment_usages.list( resource_group_name=resource_group.name, environment_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_diagnostics_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_diagnostics_operations.py index f8935803c0df..10da13959b88 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_diagnostics_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_diagnostics_operations.py @@ -24,7 +24,7 @@ def test_get_root(self, resource_group): response = self.client.managed_environments_diagnostics.get_root( resource_group_name=resource_group.name, environment_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_diagnostics_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_diagnostics_operations_async.py index 45c096f994d8..62bd4fd73518 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_diagnostics_operations_async.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_diagnostics_operations_async.py @@ -25,7 +25,7 @@ async def test_get_root(self, resource_group): response = await self.client.managed_environments_diagnostics.get_root( resource_group_name=resource_group.name, environment_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_operations.py index c3693ddfef44..ca60ccd51d1a 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_operations.py @@ -22,7 +22,7 @@ def setup_method(self, method): @recorded_by_proxy def test_list_by_subscription(self, resource_group): response = self.client.managed_environments.list_by_subscription( - api_version="2024-03-01", + api_version="2024-08-02-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -33,7 +33,7 @@ def test_list_by_subscription(self, resource_group): def test_list_by_resource_group(self, resource_group): response = self.client.managed_environments.list_by_resource_group( resource_group_name=resource_group.name, - api_version="2024-03-01", + api_version="2024-08-02-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -45,7 +45,7 @@ def test_get(self, resource_group): response = self.client.managed_environments.get( resource_group_name=resource_group.name, environment_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself @@ -59,11 +59,13 @@ def test_begin_create_or_update(self, resource_group): environment_name="str", environment_envelope={ "location": "str", + "appInsightsConfiguration": {"connectionString": "str"}, "appLogsConfiguration": { "destination": "str", - "logAnalyticsConfiguration": {"customerId": "str", "sharedKey": "str"}, + "logAnalyticsConfiguration": {"customerId": "str", "dynamicJsonColumns": bool, "sharedKey": "str"}, }, "customDomainConfiguration": { + "certificateKeyVaultProperties": {"identity": "str", "keyVaultUrl": "str"}, "certificatePassword": "str", "certificateValue": bytes("bytes", encoding="utf-8"), "customDomainVerificationId": "str", @@ -79,13 +81,59 @@ def test_begin_create_or_update(self, resource_group): "deploymentErrors": "str", "eventStreamEndpoint": "str", "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, "infrastructureResourceGroup": "str", "kedaConfiguration": {"version": "str"}, "kind": "str", "name": "str", + "openTelemetryConfiguration": { + "destinationsConfiguration": { + "dataDogConfiguration": {"key": "str", "site": "str"}, + "otlpConfigurations": [ + { + "endpoint": "str", + "headers": [{"key": "str", "value": "str"}], + "insecure": bool, + "name": "str", + } + ], + }, + "logsConfiguration": {"destinations": ["str"]}, + "metricsConfiguration": {"destinations": ["str"], "includeKeda": bool}, + "tracesConfiguration": {"destinations": ["str"], "includeDapr": bool}, + }, "peerAuthentication": {"mtls": {"enabled": bool}}, "peerTrafficConfiguration": {"encryption": {"enabled": bool}}, + "privateEndpointConnections": [ + { + "groupIds": ["str"], + "id": "str", + "name": "str", + "privateEndpoint": {"id": "str"}, + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + } + ], "provisioningState": "str", + "publicNetworkAccess": "str", "staticIp": "str", "systemData": { "createdAt": "2020-02-20 00:00:00", @@ -105,11 +153,17 @@ def test_begin_create_or_update(self, resource_group): "platformReservedDnsIP": "str", }, "workloadProfiles": [ - {"name": "str", "workloadProfileType": "str", "maximumCount": 0, "minimumCount": 0} + { + "name": "str", + "workloadProfileType": "str", + "enableFips": False, + "maximumCount": 0, + "minimumCount": 0, + } ], "zoneRedundant": bool, }, - api_version="2024-03-01", + api_version="2024-08-02-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -121,7 +175,7 @@ def test_begin_delete(self, resource_group): response = self.client.managed_environments.begin_delete( resource_group_name=resource_group.name, environment_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -135,11 +189,13 @@ def test_begin_update(self, resource_group): environment_name="str", environment_envelope={ "location": "str", + "appInsightsConfiguration": {"connectionString": "str"}, "appLogsConfiguration": { "destination": "str", - "logAnalyticsConfiguration": {"customerId": "str", "sharedKey": "str"}, + "logAnalyticsConfiguration": {"customerId": "str", "dynamicJsonColumns": bool, "sharedKey": "str"}, }, "customDomainConfiguration": { + "certificateKeyVaultProperties": {"identity": "str", "keyVaultUrl": "str"}, "certificatePassword": "str", "certificateValue": bytes("bytes", encoding="utf-8"), "customDomainVerificationId": "str", @@ -155,13 +211,59 @@ def test_begin_update(self, resource_group): "deploymentErrors": "str", "eventStreamEndpoint": "str", "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, "infrastructureResourceGroup": "str", "kedaConfiguration": {"version": "str"}, "kind": "str", "name": "str", + "openTelemetryConfiguration": { + "destinationsConfiguration": { + "dataDogConfiguration": {"key": "str", "site": "str"}, + "otlpConfigurations": [ + { + "endpoint": "str", + "headers": [{"key": "str", "value": "str"}], + "insecure": bool, + "name": "str", + } + ], + }, + "logsConfiguration": {"destinations": ["str"]}, + "metricsConfiguration": {"destinations": ["str"], "includeKeda": bool}, + "tracesConfiguration": {"destinations": ["str"], "includeDapr": bool}, + }, "peerAuthentication": {"mtls": {"enabled": bool}}, "peerTrafficConfiguration": {"encryption": {"enabled": bool}}, + "privateEndpointConnections": [ + { + "groupIds": ["str"], + "id": "str", + "name": "str", + "privateEndpoint": {"id": "str"}, + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + } + ], "provisioningState": "str", + "publicNetworkAccess": "str", "staticIp": "str", "systemData": { "createdAt": "2020-02-20 00:00:00", @@ -181,11 +283,17 @@ def test_begin_update(self, resource_group): "platformReservedDnsIP": "str", }, "workloadProfiles": [ - {"name": "str", "workloadProfileType": "str", "maximumCount": 0, "minimumCount": 0} + { + "name": "str", + "workloadProfileType": "str", + "enableFips": False, + "maximumCount": 0, + "minimumCount": 0, + } ], "zoneRedundant": bool, }, - api_version="2024-03-01", + api_version="2024-08-02-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -197,7 +305,7 @@ def test_get_auth_token(self, resource_group): response = self.client.managed_environments.get_auth_token( resource_group_name=resource_group.name, environment_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself @@ -209,7 +317,7 @@ def test_list_workload_profile_states(self, resource_group): response = self.client.managed_environments.list_workload_profile_states( resource_group_name=resource_group.name, environment_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_operations_async.py index a82a4daec142..822bdeec9d75 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_operations_async.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_operations_async.py @@ -23,7 +23,7 @@ def setup_method(self, method): @recorded_by_proxy_async async def test_list_by_subscription(self, resource_group): response = self.client.managed_environments.list_by_subscription( - api_version="2024-03-01", + api_version="2024-08-02-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -34,7 +34,7 @@ async def test_list_by_subscription(self, resource_group): async def test_list_by_resource_group(self, resource_group): response = self.client.managed_environments.list_by_resource_group( resource_group_name=resource_group.name, - api_version="2024-03-01", + api_version="2024-08-02-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -46,7 +46,7 @@ async def test_get(self, resource_group): response = await self.client.managed_environments.get( resource_group_name=resource_group.name, environment_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself @@ -61,11 +61,17 @@ async def test_begin_create_or_update(self, resource_group): environment_name="str", environment_envelope={ "location": "str", + "appInsightsConfiguration": {"connectionString": "str"}, "appLogsConfiguration": { "destination": "str", - "logAnalyticsConfiguration": {"customerId": "str", "sharedKey": "str"}, + "logAnalyticsConfiguration": { + "customerId": "str", + "dynamicJsonColumns": bool, + "sharedKey": "str", + }, }, "customDomainConfiguration": { + "certificateKeyVaultProperties": {"identity": "str", "keyVaultUrl": "str"}, "certificatePassword": "str", "certificateValue": bytes("bytes", encoding="utf-8"), "customDomainVerificationId": "str", @@ -81,13 +87,59 @@ async def test_begin_create_or_update(self, resource_group): "deploymentErrors": "str", "eventStreamEndpoint": "str", "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, "infrastructureResourceGroup": "str", "kedaConfiguration": {"version": "str"}, "kind": "str", "name": "str", + "openTelemetryConfiguration": { + "destinationsConfiguration": { + "dataDogConfiguration": {"key": "str", "site": "str"}, + "otlpConfigurations": [ + { + "endpoint": "str", + "headers": [{"key": "str", "value": "str"}], + "insecure": bool, + "name": "str", + } + ], + }, + "logsConfiguration": {"destinations": ["str"]}, + "metricsConfiguration": {"destinations": ["str"], "includeKeda": bool}, + "tracesConfiguration": {"destinations": ["str"], "includeDapr": bool}, + }, "peerAuthentication": {"mtls": {"enabled": bool}}, "peerTrafficConfiguration": {"encryption": {"enabled": bool}}, + "privateEndpointConnections": [ + { + "groupIds": ["str"], + "id": "str", + "name": "str", + "privateEndpoint": {"id": "str"}, + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + } + ], "provisioningState": "str", + "publicNetworkAccess": "str", "staticIp": "str", "systemData": { "createdAt": "2020-02-20 00:00:00", @@ -107,11 +159,17 @@ async def test_begin_create_or_update(self, resource_group): "platformReservedDnsIP": "str", }, "workloadProfiles": [ - {"name": "str", "workloadProfileType": "str", "maximumCount": 0, "minimumCount": 0} + { + "name": "str", + "workloadProfileType": "str", + "enableFips": False, + "maximumCount": 0, + "minimumCount": 0, + } ], "zoneRedundant": bool, }, - api_version="2024-03-01", + api_version="2024-08-02-preview", ) ).result() # call '.result()' to poll until service return final result @@ -125,7 +183,7 @@ async def test_begin_delete(self, resource_group): await self.client.managed_environments.begin_delete( resource_group_name=resource_group.name, environment_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) ).result() # call '.result()' to poll until service return final result @@ -141,11 +199,17 @@ async def test_begin_update(self, resource_group): environment_name="str", environment_envelope={ "location": "str", + "appInsightsConfiguration": {"connectionString": "str"}, "appLogsConfiguration": { "destination": "str", - "logAnalyticsConfiguration": {"customerId": "str", "sharedKey": "str"}, + "logAnalyticsConfiguration": { + "customerId": "str", + "dynamicJsonColumns": bool, + "sharedKey": "str", + }, }, "customDomainConfiguration": { + "certificateKeyVaultProperties": {"identity": "str", "keyVaultUrl": "str"}, "certificatePassword": "str", "certificateValue": bytes("bytes", encoding="utf-8"), "customDomainVerificationId": "str", @@ -161,13 +225,59 @@ async def test_begin_update(self, resource_group): "deploymentErrors": "str", "eventStreamEndpoint": "str", "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, "infrastructureResourceGroup": "str", "kedaConfiguration": {"version": "str"}, "kind": "str", "name": "str", + "openTelemetryConfiguration": { + "destinationsConfiguration": { + "dataDogConfiguration": {"key": "str", "site": "str"}, + "otlpConfigurations": [ + { + "endpoint": "str", + "headers": [{"key": "str", "value": "str"}], + "insecure": bool, + "name": "str", + } + ], + }, + "logsConfiguration": {"destinations": ["str"]}, + "metricsConfiguration": {"destinations": ["str"], "includeKeda": bool}, + "tracesConfiguration": {"destinations": ["str"], "includeDapr": bool}, + }, "peerAuthentication": {"mtls": {"enabled": bool}}, "peerTrafficConfiguration": {"encryption": {"enabled": bool}}, + "privateEndpointConnections": [ + { + "groupIds": ["str"], + "id": "str", + "name": "str", + "privateEndpoint": {"id": "str"}, + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + } + ], "provisioningState": "str", + "publicNetworkAccess": "str", "staticIp": "str", "systemData": { "createdAt": "2020-02-20 00:00:00", @@ -187,11 +297,17 @@ async def test_begin_update(self, resource_group): "platformReservedDnsIP": "str", }, "workloadProfiles": [ - {"name": "str", "workloadProfileType": "str", "maximumCount": 0, "minimumCount": 0} + { + "name": "str", + "workloadProfileType": "str", + "enableFips": False, + "maximumCount": 0, + "minimumCount": 0, + } ], "zoneRedundant": bool, }, - api_version="2024-03-01", + api_version="2024-08-02-preview", ) ).result() # call '.result()' to poll until service return final result @@ -204,7 +320,7 @@ async def test_get_auth_token(self, resource_group): response = await self.client.managed_environments.get_auth_token( resource_group_name=resource_group.name, environment_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself @@ -216,7 +332,7 @@ async def test_list_workload_profile_states(self, resource_group): response = self.client.managed_environments.list_workload_profile_states( resource_group_name=resource_group.name, environment_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_storages_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_storages_operations.py index b644b17854cf..07d3f3d84dd2 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_storages_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_storages_operations.py @@ -24,7 +24,7 @@ def test_list(self, resource_group): response = self.client.managed_environments_storages.list( resource_group_name=resource_group.name, environment_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself @@ -37,7 +37,7 @@ def test_get(self, resource_group): resource_group_name=resource_group.name, environment_name="str", storage_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself @@ -54,7 +54,8 @@ def test_create_or_update(self, resource_group): "id": "str", "name": "str", "properties": { - "azureFile": {"accessMode": "str", "accountKey": "str", "accountName": "str", "shareName": "str"} + "azureFile": {"accessMode": "str", "accountKey": "str", "accountName": "str", "shareName": "str"}, + "nfsAzureFile": {"accessMode": "str", "server": "str", "shareName": "str"}, }, "systemData": { "createdAt": "2020-02-20 00:00:00", @@ -66,7 +67,7 @@ def test_create_or_update(self, resource_group): }, "type": "str", }, - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself @@ -79,7 +80,7 @@ def test_delete(self, resource_group): resource_group_name=resource_group.name, environment_name="str", storage_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_storages_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_storages_operations_async.py index f44a5e0b4304..5e6af988708e 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_storages_operations_async.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_managed_environments_storages_operations_async.py @@ -25,7 +25,7 @@ async def test_list(self, resource_group): response = await self.client.managed_environments_storages.list( resource_group_name=resource_group.name, environment_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself @@ -38,7 +38,7 @@ async def test_get(self, resource_group): resource_group_name=resource_group.name, environment_name="str", storage_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself @@ -55,7 +55,8 @@ async def test_create_or_update(self, resource_group): "id": "str", "name": "str", "properties": { - "azureFile": {"accessMode": "str", "accountKey": "str", "accountName": "str", "shareName": "str"} + "azureFile": {"accessMode": "str", "accountKey": "str", "accountName": "str", "shareName": "str"}, + "nfsAzureFile": {"accessMode": "str", "server": "str", "shareName": "str"}, }, "systemData": { "createdAt": "2020-02-20 00:00:00", @@ -67,7 +68,7 @@ async def test_create_or_update(self, resource_group): }, "type": "str", }, - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself @@ -80,7 +81,7 @@ async def test_delete(self, resource_group): resource_group_name=resource_group.name, environment_name="str", storage_name="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_namespaces_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_namespaces_operations.py index e2b8fb59bc41..2c6343949e2f 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_namespaces_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_namespaces_operations.py @@ -25,7 +25,7 @@ def test_check_name_availability(self, resource_group): resource_group_name=resource_group.name, environment_name="str", check_name_availability_request={"name": "str", "type": "str"}, - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_namespaces_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_namespaces_operations_async.py index daeee7c5da1c..4d7d402a20d7 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_namespaces_operations_async.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_namespaces_operations_async.py @@ -26,7 +26,7 @@ async def test_check_name_availability(self, resource_group): resource_group_name=resource_group.name, environment_name="str", check_name_availability_request={"name": "str", "type": "str"}, - api_version="2024-03-01", + api_version="2024-08-02-preview", ) # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_operations.py index e80fa5ba763c..a6f1201eb482 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_operations.py @@ -22,7 +22,7 @@ def setup_method(self, method): @recorded_by_proxy def test_list(self, resource_group): response = self.client.operations.list( - api_version="2024-03-01", + api_version="2024-08-02-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_operations_async.py index 7dfd8600db2b..79e186721f08 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_operations_async.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_operations_async.py @@ -23,7 +23,7 @@ def setup_method(self, method): @recorded_by_proxy_async async def test_list(self, resource_group): response = self.client.operations.list( - api_version="2024-03-01", + api_version="2024-08-02-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_usages_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_usages_operations.py index 4572a67a7083..04acf42ae22d 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_usages_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_usages_operations.py @@ -23,7 +23,7 @@ def setup_method(self, method): def test_list(self, resource_group): response = self.client.usages.list( location="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_usages_operations_async.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_usages_operations_async.py index 4e439a0bc453..d463d34828e8 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_usages_operations_async.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_tests/test_container_apps_api_usages_operations_async.py @@ -24,7 +24,7 @@ def setup_method(self, method): async def test_list(self, resource_group): response = self.client.usages.list( location="str", - api_version="2024-03-01", + api_version="2024-08-02-preview", ) result = [r async for r in response] # please add some check logic here by yourself